Tuesday, November 19, 2019

Re: Adding maps

Source: https://stackoverflow.com/questions/23543415/how-to-add-google-map-for-gwt-into-formpanel

How to add Google map for GWT into FormPanel?

Here is the code.

Simply call below line and the map is added in formPanel.

GoogleMap gMap = GoogleMap.create(formPanel.getElement(), options);

Some more configuration as defined below:

  • gwt.xml:

    <inherits name="com.google.maps.gwt.GoogleMaps" />  <script src="http://maps.google.com/maps/api/js?sensor=false" />
  • gwt-maps.jar in build path of the project.


Sample code:

public void onModuleLoad() {      FormPanel formPanel = new FormPanel();      formPanel.setWidth("500px");      formPanel.setHeight("650px");        RootPanel.get().add(formPanel);        MapOptions options = MapOptions.create();        options.setZoom(6);      options.setMapTypeId(MapTypeId.ROADMAP);      options.setDraggable(true);      options.setMapTypeControl(true);      options.setScaleControl(true);      options.setScrollwheel(true);        GoogleMap gMap = GoogleMap.create(formPanel.getElement(), options);        gMap.setCenter(LatLng.create(58.378679, -2.197266));  }

On Tuesday, 19 November 2019 16:56:29 UTC+5:30, shubhangi agarwal wrote:
I'm trying tp implant google Maps on gwt tab panel. but unfortunately unable to do so. please help

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit/80fecec4-20c5-475d-a256-bceed88cb0d3%40googlegroups.com.

No comments:

Post a Comment