Google Maps Find Altitude

Determine the altitude (elevation) when a point is tapped/clicked on a map

[Map Height : Small - Medium - Large]

Upload and Plot Addresses

Paste one address per line then click [Load]. There is a limit of 100 rows per batch. Any additional rows will be ignored.

Description

Use a map to determining altitude (elevation) when a point is tapped/clicked on a map. You can click/tap ad many times as required to find the elevation of multiple points.

Google Maps Find Altitude

How To Use

  1. Click on the map on a location where you wish to find the altitude
  2. The altitude will be displayed in the message box below the map and when you hover over the marker
  3. You can click to place more than one marker and return to hover over each in order to find out the altitude again
  4. Click the [Clear Map] button in order to remove all markers and start again
  5. Use the search option to find a place
  6. Click on a marker to remove it

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 output_lat =new Array(0);
var output_lng =new Array(0);
var output_f =new Array(0);
var output_m =new Array(0);
var outputDiv=document.getElementById('outputDiv');
var map;
var routeMarkers=new Array(0);
var routePoints=new Array(0);
var geocoder;
var latlngbounds;	
var addresslimit=100;
var bool_toggle_draw_line=false;
var lineWidth=1;
var lineColor='#ff0066';
var routePath;

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},scaleControl:true};
	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', mapclickedevent);
		  
	geocoder = new google.maps.Geocoder();	
	latlngbounds = new google.maps.LatLngBounds();
}

function foundsingle(first)
{
	var latlng = new google.maps.LatLng (parseFloat(first.lat),parseFloat(first.lng));
	var obj=new Object();
	obj.latLng=latlng;
	getElevation(obj);
}

function mapclickedevent(event)
{
	getElevation(event.latLng); 
}

function getElevation(clickedLocation) 
{
	var locations = [];
		
	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 / " + (results[0].elevation*3.2808399).toFixed(3) + " feet";
				
				//add the marker
				var marker=placeMarker(clickedLocation,results[0].elevation.toFixed(3) + " m / " + (results[0].elevation*3.2808399).toFixed(3) + " feet");
				marker.setMap(map);
				addCloseEvent(marker,routeMarkers.length);
				
				routeMarkers.push(marker);
				ftn_drawline();	
				
				latlngbounds.extend(clickedLocation);
				
				output_lat.push(clickedLocation.lat());
				output_lng.push(clickedLocation.lng());
				output_f.push((results[0].elevation*3.2808399).toFixed(3));
				output_m.push(results[0].elevation.toFixed(3));
				
				ftn_makecsv();
			} 
			else 
			{
				outputDiv.innerHTML="No results found";
			}
	  	} 
	  	else 
	  	{
			outputDiv.innerHTML="Elevation service failed due to: " + status;
		}
	});
}

function addCloseEvent(marker,index) {
  	marker.addListener('click', function() {
	marker.setMap(null);
		
	if (routeMarkers.length > 1)
	{
		ftn_drawline();
	}
	else
	{
		//hide the polyline
		if (routePath)
		routePath.setMap(null);
	}
	ftn_makecsv(); 
  });
}

function placeMarker(location,text) 
{
	var image = 'images/gmmarkersv3/stripes.png';
	var marker = new google.maps.Marker({position:location,map:map,icon:image,title:text});
	return marker;
}

function clearmap()
{
	if (routeMarkers) 
	{
		for (i in routeMarkers) 
		{
			routeMarkers[i].setMap(null);
		}
	}
	routeMarkers=new Array(0);

	if (routePath)
	{
		routePath.setMap(null);
	}
	
	outputDiv.innerHTML="";
	
	latlngbounds = new google.maps.LatLngBounds();
	
	output_lat = new Array(0);
	output_lng = new Array(0);
	output_f = new Array(0);
	output_m = new Array(0);
	
	document.getElementById("ta_csvoutput").style.display="none";
	document.getElementById("ta_csvoutput").value="";
	
	document.getElementById("goto").value="";
	document.getElementById("btn_go").value="Search";
}

function ftn_makecsv()
{
	document.getElementById("ta_csvoutput").style.display="block";
	document.getElementById("ta_csvoutput").value="";
	
	output="number";
	if (document.getElementById("cb_output_latlng").checked)
	{
		output+=",latitude,longitude";
	}
	if (document.getElementById("cb_output_meters").checked)
	{
		output+=",meters";
	}
	if (document.getElementById("cb_output_feet").checked)
	{
		output+=",feet";
	}
	if (document.getElementById("cb_output_cumulativedistance").checked)
	{
		output+=",cumulative distance (m)";
	}
	output+="\n";
		
	var cumulativedistance=0;
	
	for (i in routeMarkers) 
	{
		if (routeMarkers[i].getMap())
		{
			
			output+=(i + 1);
			if (document.getElementById("cb_output_latlng").checked)
			{
				output+=","+output_lat[i]+","+output_lng[i];
			}
			if (document.getElementById("cb_output_meters").checked)
			{
				output+=","+output_m[i];
			}
			if (document.getElementById("cb_output_feet").checked)
			{
				output+=","+output_f[i];
			}
			if (document.getElementById("cb_output_cumulativedistance").checked)
			{
				var tmp_cumdist=google.maps.geometry.spherical.computeDistanceBetween(routeMarkers[0].getPosition(), routeMarkers[i].getPosition());
				cumulativedistance=parseInt(cumulativedistance) + parseInt(tmp_cumdist.toFixed(0));
				output+=","+cumulativedistance;
			}
			output+="\n";
		}
	}
	
	document.getElementById("ta_csvoutput").value=output;
}

function submitenter(myfield,e)
{
	var keycode;
	if (window.event) keycode = window.event.keyCode;
	else if (e) keycode = e.which;
	else return true;
	
	if (keycode == 13)
	{
		ftn_quickfind(document.getElementById('goto').value);
		document.getElementById("goto").focus();
		document.getElementById("goto").select();
		return false;
	}
	else
	{
	   return true;
	}
}

function ftn_quickfind(address) 
{
	document.getElementById("btn_go").value="Searching...";
	geocoder.geocode( { 'address': address}, function(results, status) 
	{
		if (status == google.maps.GeocoderStatus.OK) 
		{
        	var point = results[0].geometry.location;
			if (document.getElementById("cb_dropmarker").checked)
			{
				getElevation(point);
			}
	
			map.setCenter(point);
			map.fitBounds(results[0].geometry.viewport);
			document.getElementById("btn_go").value="Found";  	
      	} 
		else 
		{
			document.getElementById("btn_go").value="Not Found";
			//console.log(address);
      	}
   	});
}

function ftn_zoomtofit()
{
	map.setCenter(latlngbounds.getCenter());
	map.fitBounds(latlngbounds);	
}

function ftn_processaddressupload(str_addresses)
{
	lines = str_addresses.split('\n');
	if (lines.length>addresslimit)
	{
		lines = lines.slice(0,addresslimit);
	}
	cnt=0;
	nextaddress();	
}

function nextaddress()
{
	if (cnt>=lines.length) 
	{
		document.getElementById("btn_ok").title="Complete!";
		ftn_zoomtofit();
		//$.unblockUI(); 
		return;
	}	
	else
	{
		document.getElementById("btn_ok").title="Processed "+(cnt+1)+"/"+lines.length;
	}
	ftn_geocodeaddress(lines[cnt],getElevation);
	cnt++;
}

function ftn_geocodeaddress(address, callbackFunction) 
{
	geocoder.geocode( { 'address': address}, function(results, status) 
	{
		if (status == google.maps.GeocoderStatus.OK) 
		{
			var point = results[0].geometry.location;
			callbackFunction(point);
			nextaddress();
		}
		else
		{
			alert("Address ("+address+")not found!");
			nextaddress();
		}
	});
}

function ftn_toggle_draw_line()
{
	bool_toggle_draw_line=!bool_toggle_draw_line;
	ftn_drawline();	
}

function ftn_drawline()
{
	if (routePath)
	routePath.setMap(null);
	
	//rebuild routePoints based on markers location
	routePoints=new Array(0);
	if (routeMarkers) 
	{
		for (i in routeMarkers) 
		{
			if (routeMarkers[i].getMap())
			{
				routePoints.push(routeMarkers[i].getPosition());
			}
		}
	}
	
	if ((bool_toggle_draw_line)&&(routePoints.length>1))
	{
		routePath=getRoutePath();
		routePath.setMap(map);
	}
	else
	{
		if (routePath)
		routePath.setMap(null);
	}	
}

function getRoutePath()
{
	var routePath = new google.maps.Polyline({
		path: routePoints,
		strokeColor: lineColor,
		strokeOpacity: 1.0,
		strokeWeight: lineWidth,
		geodesic: true
	});
	return routePath;
}

Relevant Links

Google Maps API

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/12/2009)
    • Output now also displayed in feet
  • Version 2.0 (10/08/2010)
  • 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)
    • Now outputs altitude immediatly from a search
  • Version 2.4 (07/10/2013)
    • Added scale control
  • Version 2.4 (10/11/2013)
    • Removed Google Local Search API (Deprecated)
  • Version 3.0 (23/11/2013) - You are here
    • Added option to Upload and Plot Addresses with their elevation
  • Version 3.1 (26/10/2015)
    • New option to draw a line between the markers
  • Version 3.2 (18/08/2016)
    • Cumulative distance is now output
  • Version 3.3 (16/10/2016)
    • Clicking on an elevation marker now removes it

Comments For This Page

40 lady game drive killara NSW 2071
On 3rd November 2017
Chutiya mat banao. Doesn't work. According to this Washington monument is shorter than Washington national Cathedral.
On 22nd October 2017
Since some weeks I have an error message "Elevation service failed due to: OVER_QUERY_LIMIT" and cannot measure altitude :-(
By Michal on 10th September 2017
On 6th September 2017, please reload the page and try again.
By Daft Logic on 7th September 2017
Cannot place markers by clicking on the map.
On 6th September 2017
I tried to use this terrific site again for friends in West Palm Beach, but it isn't working. It says only: "Elevation service failed due to over_query_limit" Can anyone please help?
By Paul Brala on 6th September 2017
This website helped me seek higher ground to keep my car from flooding during Tropical Storm Harvey in Houston. When I get to my car, I may find it flooded, but with 24" less rain than in my garage. Anything to avoid trying to get a rental car, towing and mechanical service at the same time as so many other people in the region. Thank you.
By NK on 28th August 2017
Great work, very helpful!
On 24th August 2017
Re: can't get street view again I'm using an Android phone and not seeing an arrow in left corner tried refreshing but not sure I'm doing it correctly ,thank you for responding to my first post.
By Mark on 10th August 2017
Hi, there will be an arrow at the top left of the map. Or .... just refresh the page
By Daft Logic on 9th August 2017
Some how I got in street view and can't get there again? Any ideas?
By Mark on 8th August 2017
Is the distance from the last point? I am trying to plot a hillside and it seems to show a lot of distance between two points that should be a lot closer.
By Dave on 26th July 2017
Thank you, DaftLogic. Nice work.

I wanted to reply to the guy who seemed to complain about the negative elevation on the ocean map.

The ocean is below sea level, some places very deeply so. I went to https://www.arcgis.com/home/webmap/viewer.html?webmap=5ae9e138a17842688b0b79283a4353f6 and went to your coordinates and found the estimated depth at your spot to be -5547m, or -18198'. So, about 2000' off. I'm fine with this estimate. 'Course, this discrepancy would blow at my location, at about 2500', The differences I found in my community on dl's map seem reasonable. I imagine depth, uh, elevation studies, and mapping, have been more in number and of greater sensitivity above sea levels, since that's where most of us live.

Cheers-
By Liz in Tucson, AZ on 21st July 2017
Hello
It worked well at first, but tonight when I was trying to drop a marker by clicking with mouse, a message appears saying "Elevation service failed due to: OVER_QUERY_LIMIT".
So what's wrong with it? Is it an error from me or from this service?
I need help because I really need this important tool.
By amohy on 20th July 2017
I have a slightly different situation. If I am seeing a fire on a nearby mountain side. I want to know the lat, lon and altitude of the fire. I have a surveying instrument set up on a known point in my yard. I see a fire burning at a true azimuth of 56 degrees, 30 minutes 35 seconds. I am at 802 meters asl, lat 48.782709, -117.288198. This is based on a real fire that I called in to emergency services. I had just shot polaris the previous night and was trying to determine the offset of polaris at the time of observation to my true north marker.

On 19th July 2017
Drawing on a map with a mouse is OK but what I am looking for is a way to tell the lat, lon and elevation of a distant point by inputting the starting location (lat, lon, elevation above sea level) and then moving out on a specified azimuth at a specified elevation angle. Sort of like if I am at 48.221, -117.2887 at 892 meters above sea level and I take my 5 mw green laser and point it at 46 degrees azimuth at an inclination of 15 degrees the spot on the hill side will be at xxx lat, yyy lon zzz elevation above sea level.
By sunwukong on 17th July 2017
Hi Russell, this page simply shows how to achieve the same functionality on another webpage. There is no effort made to explain how to use it in any other way such as with Python . Sorry.
By Daft Logic on 17th July 2017
Hi
Can I use your program in Python and if so how do I input it into Python. Very new to this as you can see!
I do a lot of route assessments in Africa for mining and oil and gas companies and have been looking for a way to get elevation data from Lat Long co-ordinates.
By Russell Knight on 15th July 2017
Hi Ben, Have a look at replies to previous comments that use the two terms 'datum' and 'thanks'.
By Daft Logic on 13th July 2017
What vertical datum is referenced for elevation? NAVD88? I see two previous requests for this information without a response.
By Ben on 13th July 2017
Very good tool!
By Sara on 2nd July 2017
Your map is telling me that the altitude in the middle of the Atlantic ocean is -16.000 ft.
IE:
number,latitude,longitude,meters,feet
01,38.50519140240356,-39.781494140625,-4880.426,-16011.897

I'd say you have a serious error.
By halglas**fl.rr.com on 23rd June 2017
Slick tool! Just one thing: Your tool indicates ELEVATION. It does NOT indicate ALTITUDE.
https://en.wikipedia.org/wiki/Elevation
"ELEVATION, or geometric height, is mainly used when referring to points on the Earth's surface, while ALTITUDE or geopotential height is used for points above the surface, such as an aircraft in flight or a spacecraft in orbit."

By Terminology Police on 14th June 2017

Sincerely congratulations to the program, I am a technically qualified graduate and fond of level curves. I'm making the plastic for the medieval medieval village where I live (Motta Santa Anastasia, Catania, Sicily, Italy) and even having a detailed altitude map your program is very useful. Obviously I need some other useful points in the world, so I wonder if there is a apple app for course also for payment .... Thanksgiving
salve! sinceri complimenti per il programma, sono diplomato tecnico geometra ed appassionato di curve di livello. Sto realizzando il plastico per il bel borgo medioevale dove abito (Motta Santa Anastasia, Catania, Sicilia,Italia) e pur avendo una mappa dettagliata di altitudine il vostro programma molto utile. Ovviamente mi serve per altri punti utili nel mondo, per questo vi chiedo se c' una applicazione per apple ovviamente anche a pagamento.... .Cordiali saluti
By ENZO GIOITTA gioitta.enzo@alic on 13th June 2017
Hi Bill, the elevation is based on mean sea level, so without know exactly where you sampled the elevation, there is a chance the image shows the tide in.
By Daft Logic on 15th May 2017

when checking elevations it seems if you select the height over water , example in long island off New Haven / West Haven CT. it shows about 4.8 feet. I thought it would be zero until on shore.
By Bill on 14th May 2017
Hi, no it would be the ground level elevation that gets estimated.
By Daft Logic on 2nd May 2017
When I click on a house, does the altitude including height of the house?

Thanks,
On 1st May 2017
Great tool. Thanks!
On 22nd April 2017
Hi, we do have limits on this shared service so from time to time this will happen. It will run again the following day. We will monitor this to check the frequency of this message.
By Daft Logic on 16th February 2017

30 out of 485 comments shown. See all comments.

Add your own comment below and let others know what you think:

Share This Page

Share this page with others using one of the methods below. Telling others about Daft Logic is good and we appreciate your support!