Remove Satellite and Terrain tab from Google Map
Normally when we create Google map it automatically shows two tabs on the google map.Below are the example of the normal google map.
Below are the code that produce above map
function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); map.setUIToDefault(); } }
Now to remove satellite and Terrain tab you need to modify above code like below
function initialize() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map_canvas")); map.setCenter(new GLatLng(37.4419, -122.1419), 13); /* Simply comment below line this will remove all three tabs as well as controller from the map */ // map.setUIToDefault(); /* Now just show show controller on the map exclusively by adding below code */ map.removeMapType(G_HYBRID_MAP); map.removeMapType(G_SATELLITE_MAP); map.addControl(new GLargeMapControl3D); var mapControl = new GMapTypeControl(); map.addControl(mapControl); } }
Here one thing is notable we have added removeMapType function again to hadle any luck of removing map tabs anyhow.
Chandra Shekhar
Latest posts by Chandra Shekhar (see all)
- Best practices for micro service design - January 23, 2022
- Spring Boot - January 23, 2022
- Java - January 23, 2022
Recent Comments