Google Maps and GWT: how to put a text label on a map?
I am using this api http://gwt-google-apis.googlecode.com/svn/javadoc/maps/1.1/index.html , the GWT Google Maps API, in my application.
Now I want to render some tex开发者_如何学Ct on different coordinates on the map. But.... how?
I have googled around, but it seems there isn't a clear solution?
Any ideas if/how it is possible using some sort of JSNI solution?
You can add markers to the map as described in the GWT Maps Getting started Guide:
LatLng cawkerCity = LatLng.newInstance(39.509, -98.434);
map.addOverlay(new Marker(cawkerCity));
If you want to render your text directly on the map, you can extend com.google.gwt.maps.client.overlay.Overlay (to create a text overlay). An example of a custom map overlay can be found at http://timlwhite.typepad.com/blog/2008/08/creating-custom-google-maps-overlays-with-gwt-widgets.html
精彩评论