Google Maps Find Altitude
Search :
| Output latitude,longitude? | Output in meters? | Output in feet? |
Description
A method of determining altitude (height) when a point is clicked on a map.
How To Use
- Click on the map on a location where you wish to find the altitude
- The altitude will be displayed in the message box below the map and when you hover over the marker
- You can click to place more than one marker and return to hover over each in order to find out the altitude again
- Click the [Clear Map] button in order to remove all markers and start again
- Use the search option to find a place
You can also access a CSV list of latitude, longitude, altitude in meters and altitude in feet for every marker you place on the map.
How it Works
var outputDiv=document.getElementById('outputDiv');
var map;
var routeMarkers=new Array(0);
function initialize()
{
var latlng = new google.maps.LatLng(0,0);
//setCursor:'crosshair'
var myOptions = {zoom:1,center:latlng,mapTypeId:google.maps.MapTypeId.ROADMAP,draggableCursor:'crosshair',mapTypeControlOptions:{style:google.maps.MapTypeControlStyle.DROPDOWN_MENU}};
map = new google.maps.Map(document.getElementById("map_canvas"),myOptions);
// Create ElevationService
elevator = new google.maps.ElevationService();
// Add a listener for the click event and call getElevation on that location
google.maps.event.addListener(map, 'click', getElevation);
}
function getElevation(event)
{
var locations = [];
// Retrieve the clicked location and push it on the array
var clickedLocation = event.latLng;
locations.push(clickedLocation);
// Create a LocationElevationRequest object using the array's one value
var positionalRequest = {'locations': locations};
// Initiate the location request
elevator.getElevationForLocations(positionalRequest, function(results, status)
{
if (status == google.maps.ElevationStatus.OK)
{
// Retrieve the first result
if (results[0])
{
// Open an info window indicating the elevation at the clicked position
outputDiv.innerHTML= "Last point clicked : " + results[0].elevation.toFixed(3) + " m";
var marker=placeMarker(clickedLocation,results[0].elevation.toFixed(3) + " m");
marker.setMap(map);
routeMarkers.push(marker);
}
else
{
outputDiv.innerHTML="No results found";
}
}
else
{
outputDiv.innerHTML="Elevation service failed due to: " + status;
}
});
}
function placeMarker(location,text)
{
var image = new google.maps.MarkerImage('http://www.daftlogic.com/images/gmmarkersv3/stripes.png',
// This marker is 20 pixels wide by 32 pixels tall.
new google.maps.Size(20, 34),
// The origin for this image is 0,0.
new google.maps.Point(0,0),
// The anchor for this image is the base of the flagpole at 0,32.
new google.maps.Point(9, 33));
var shadow = new google.maps.MarkerImage('http://www.daftlogic.com/images/gmmarkersv3/shadow.png',
// The shadow image is larger in the horizontal dimension
// while the position and offset are the same as for the main image.
new google.maps.Size(28, 22),
new google.maps.Point(0,0),
new google.maps.Point(1, 22));
var marker = new google.maps.Marker({position:location,map:map,shadow:shadow,icon:image,title:text});
return marker;
}
function clearmap()
{
if (routeMarkers)
{
for (i in routeMarkers)
{
routeMarkers[i].setMap(null);
}
}
routeMarkers=new Array(0);
}
Relevant Links
Version History
- Version 1 (28/09/2008)
- Version 1.1 (28/12/2008)
- Added quick find option
- Version 1.2 (21/03/2009)
- Enlarged output text at bottom of map
- Version 1.3 (04/012/2009)
- Output now also displayed in feet
- Version 2.0 (10/08/2010)
- Implemented Google Maps API V3
- Now uses the Google Maps API Elevation Service
- Version 2.1 (11/08/2010)
- Added new local search facility
- Brought back output in feet
- Version 2.2 (17/08/2010)
- Added output to CSV option to allow export of latitude, longitude, meters and feet
- Version 2.3 (31/08/2011) - You are here
- Now outputs altitude immediatly from a search
Previous Comments For This Page
its not accurate, are you sure it tells the elevation from the sea level. because im working on a project. where the difference in elevation betweeen two points is not more than 6 ft but here it says 26ft. that cant be correct
By Aman Duhan on 17/05/2013In general, Altitude is height above the ground (think airplanes). Elevation is height above sea level.
On 09/04/2013It is a user friendly tool. However, a few data are inaccurate, a familiar street for me it is flat at all but it display there is altitude change. Data are as follows :-
0,22.32655664059317,114.16859149932861,24.035
1,22.3266757349666,114.17125225067138,5.109
By Henry Chung ( from Hong Kong ) on 06/04/2013excellent stuff for any traveller
By arulpandian m on 31/03/2013Brilliant I live in south Wales valleys I wanted to set altimetre on my watch. I walk up and down hills everyday so it's nice to know the difference in elavation. Thanks. Mountain man dreamer. Accurate to foot.
By Paul on 29/03/2013This is a really great sight! really helped with my project :)
By Lizzie on 26/03/2013Agreement /- 1 metre with the UK OS map contour running through my house near St Austell, Cornwall, UK. The OS maps have contours referenced to Mean Sea Level.
By PrimalPete on 17/03/2013Great thing. One non-trivial feature request:
assuming I got few points along a street route, can I calculate grade in % for each of the parts?
By mtwapa on 12/03/2013My hose showed 2 meters above sea level but it sits atop a bank that is AT LEAST 6 meters. This was at Pakuranga New Zealand
On 09/03/2013love it!
By I Wear Suunto on 04/03/2013Is thIs above chart datum or mhws
By Pat on 18/02/2013great
By VM on 07/02/2013Brilliant tool, fantastic
By Husmat on 16/01/2013Love it. Helps out a lot.
On 09/01/2013thanks
On 02/01/2013great tool
On 11/12/2012thanks
By Mohamed Mounir Abou Baker on 11/12/2012I found it quite interesting. Great stuff.
By Anthony on 03/12/2012Much Appreciated
By Barb on 27/11/2012So very cool. Maybe now I can convince the wireless internet provider that I am on a hilltop and not in the valley.
By Challenger on 25/11/2012This is an amazing resource. I teach canning and since altitude affects the temperature of boiling water, it's important to know one's elevation. At higher elevations, a longer time is required to destroy as many microbes - and this applies whether you are boiling the jars in water, or using a pressure canner to super heat pressurized steam. I love this site and refer all my students here (also I add 10' for every story up if someone's kitchen is in a high rise).
By Betsy on 20/11/2012Inaccurate. I clicked on the beach near our home and it is showing the beach 68 feet above sea level.
On 18/11/2012Thank you know ican get my home work done
By on 11/122011 on 13/11/2012This is so useful, great work really needed and appreciated
By gg on 11/11/2012Brilliant job! Thanks!!
On 09/11/2012Dude, this web page was SO helpful to us! We looked up the altitude of our home in Southern Brooklyn just before Hurricane Sandy arrived, and we compared the numbers with the National Hurricane Center storm surge forecast... to our shock and dismay we realized the ocean is coming to our basement and maybe even the first floor. So we gathered just about all of our stuff from the basement and put it off the ground upstairs.
Lo and behold, the ocean did arrive and did submerge the whole basement, as well as 4 inches of the upper floor. Thank God, just about all of our stuff was spared!
If it wasn't for your website, so much would have been lost... one of us might have even died in that basement: the water came so quickly... but we were prepared! Thank you!!
By Brooklyn resident on 31/10/2012Hi,I'll comment when I see some numbers.
By Steve on 28/10/2012Found it very helpful once but now it won't show any images in the Map window. :(
On 26/10/2012awesome mate.
there can not be anything better then this
By vincent on 15/10/2012Google elevation tallies exactly with data from the Cartographic Institute data in Barcelona Spain so thumbs up
On 08/10/201230 out of 269 comments shown. See all comments.
Add your own comment below and let others know what you think: