Maps API Map() Constructor : Example Create a Google Map: Output :
Google Maps – Disable 45° Perspective View – setTilt(0) You can disable 45° perspective view by calling setTilt(0) on the Map object: Example Output : Tip: To enable 45° perspective view at a later point, call setTilt(45).
The map types SATELLITE and HYBRID support a 45° perspective imagery view for certain locations (only at high zoom levels). If you zoom into a location with 45° imagery view, the map will automatically alter the perspective view. In addition, the map will add: A compass wheel around the Pan…
The following map types are supported in Google Maps API: ROADMAP (normal, default 2D map) SATELLITE (photographic map) HYBRID (photographic map + roads and city names) TERRAIN (map with mountains, rivers, etc.) The map type is specified either within the Map properties object, with the mapTypeId property: Or by calling…
Google Maps – Custom Controls Create a custom control that always takes you back to London, when clicked (if the map is dragged). Here the code is : Output :
Google Maps – Modifying Controls Several of the map controls are configurable. The controls can be modified by specifying control options fields. For example, options for modifying a Zoom control are specified in the zoomControlOptions field. The zoomControlOptions field may contain: google.maps.ZoomControlStyle.SMALL – displays a mini-zoom control (only + and…
Google Maps – Turn On All Controls Some controls appear on the map by default; while others will not appear unless you set them. Adding or removing controls from the map is specified in the Map options object. Set the control to true to make it visible – Set the control to…
Google Maps – Disabling The Default Controls You may instead wish to turn off the default controls. To do so, set the Map’s disableDefaultUI property (within the Map options object) to true. Here the code is : Output :
Set Markers and Open InfoWindow for Each Marker Run a function when the user clicks on the map. The placeMarker() function places a marker where the user has clicked, and shows an infowindow with the latitudes and longitudes of the marker: Output :
Open an InfoWindow When Clicking on The Marker Click on the marker to show an infowindow with some text. Here the code : Output :