Adding maps

101 views
Skip to first unread message

shubhangi agarwal

unread,
Nov 19, 2019, 6:26:29 AM11/19/19
to GWT Users
I'm trying tp implant google Maps on gwt tab panel. but unfortunately unable to do so. please help

Frank

unread,
Nov 19, 2019, 7:59:00 AM11/19/19
to GWT Users

Mallikarjuna Sarvala

unread,
Nov 19, 2019, 8:58:46 AM11/19/19
to GWT Users

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:


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));
}

Frank

unread,
Nov 19, 2019, 10:33:07 AM11/19/19
to GWT Users
I am pretty convinced Mallikarjuna Sarvala's answer doesn't work in 2019
But give it a shot and let us know.
Reply all
Reply to author
Forward
0 new messages