- Home >
- Documentation >
- Services >
- getelevation
getelevation
This function allows to retrieve the google.maps.ElevationResult from a latLng
Usage
Parameters
- latLng {latLng|google.maps.latLng}
Example
This example show an InfoWindow with the elevation of the marker on marker dragend (drag & drop the marker)
$("#test").gmap3({ marker:{ latLng: [63.3333333, -150.5], options:{ draggable:true }, events:{ dragend: function(marker){ $(this).gmap3({ getelevation:{ latLng:marker.getPosition(), callback:function(results){ var map = $(this).gmap3("get"), infowindow = $(this).gmap3({get:"infowindow"}), content = results && results[0] ? Math.round(results[0].elevation) + " meters" : "no result"; if (infowindow){ infowindow.open(map, marker); infowindow.setContent(content); } else { $(this).gmap3({ infowindow:{ anchor:marker, options:{content: content} } }); } } } }); } } }, map:{ options:{ zoom: 8, mapTypeId: google.maps.MapTypeId.TERRAIN } } });