Google Maps Find Altitude

[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

A method of determining altitude (height) when a point is clicked on a map.

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

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 geocoder;

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', getElevation);

geocoder = new google.maps.Geocoder();
}

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 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 / " + (results[0].elevation*3.2808399).toFixed(3) + " feet";
var marker=placeMarker(clickedLocation,results[0].elevation.toFixed(3) + " m / " + (results[0].elevation*3.2808399).toFixed(3) + " feet");
marker.setMap(map);
routeMarkers.push(marker);

output_lat.push(event.latLng.lat());
output_lng.push(event.latLng.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 placeMarker(location,text)
{
var image = new google.maps.MarkerImage('https://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('https://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);
clearsearchresults();
document.getElementById("queryInput").value="";
outputDiv.innerHTML="";

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.visibility="hidden";
document.getElementById("ta_csvoutput").value="";
}

function ftn_makecsv()
{
var int=0;
document.getElementById("ta_csvoutput").style.visibility="visible";
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";
}
output+="\n";


for (i in routeMarkers)
{
output+=int;
if (document.getElementById("cb_output_latlng").checked)
{
output+=","+output_lat[int]+","+output_lng[int];
}
if (document.getElementById("cb_output_meters").checked)
{
output+=","+output_m[int];
}
if (document.getElementById("cb_output_feet").checked)
{
output+=","+output_f[int];
}
output+="\n";
int=int+1;
}
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_quickfind2(document.getElementById('goto').value);
document.getElementById("goto").focus();
document.getElementById("goto").select();
return false;
}
else
{
return true;
}
}

//***********************************************************************
//*****************Quick Find Option*************************************

function ftn_quickfind2(address)
{
document.getElementById("btn_go").value="Searching...";
geocoder.geocode( { 'address': address}, function(results, status)
{
if (status == google.maps.GeocoderStatus.OK)
{
var image = new google.maps.MarkerImage('https://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('https://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 point = results[0].geometry.location;

map.setCenter(point);
map.fitBounds(results[0].geometry.viewport);

document.getElementById("btn_go").value="Found";
}
else
{
//alert("Geocode was not successful for the following reason: " + status);
document.getElementById("btn_go").value="Not Found";
}
});
}

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/012/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

Comments For This Page

Hi there, thanks for the information. But I want get the info of the height of buildings, how can I mark a point and read the height of building on that place? Thx Anyone can message me to kexuu@icloud.com. Thank you
By Dave on 13/04/2016
Hi Simon, the reason for this is likely to be the address upload is searching for address locations nearby such as a road or building rather than the precise location you give. So it is doing a disfavor by doing an address search rather than plotting the exact location.
By Daft Logic on 29/03/2016
This is a great piece of software, just one problem, if i copy and paste back in the lat/long co-ordinates and 'load' the location again, it shifts the location for each set of co-ordinates from the original !
By Simon on 28/03/2016
Including the output of Degrees would be great!
On 18/03/2016
Hi malcolm, lat,lng per line should work. For example:
48.4170371,2.5922382
48.1763093,2.961972
48.1671508,3.3986785
By Daft Logic on 15/02/2016
This is an excellent tool. One issue that I have is trying to get the altitude from a list of GPS longitude and latitude coordinates from a route. Can such a list be uploaded as "addresses"? What is the required list format?
By malcolm on 15/02/2016
SOOOOO great... thank you!
On 14/02/2016
Excellent tool. Thanks. You call it Find Altitude but actually it is finding elevation. "Altitude: Vertical distance between an object and the local surface of the Earth. Elevation: Vertical distance between the local surface of the Earth and global sea level."
By Marco on 12/02/2016
Hi, please try the coordinates in the format latitude,longitude. E.g. 48.8583701,2.2944813 for the Eiffel Tower.
By Daft Logic on 08/02/2016
Tried pasting 4339%u203223%u2033N 7016%u203238%u2033W into the search bar and it came back "Not Found". I recall being able to paste coordinates in this format in previous versions. Aside from that, LOVE this tool.
On 06/02/2016
1 ) you need to put some distance between the figures you display for point number, lat, long, elevation. 2) You need to say what kind of distance the elevation data is averaged over. I wanted to find the elevation of a river - I put down several markers in the flat-surfaced river and they came back with a 2 metre spread of elevation. I know you're just reporting what Google tells you but a guide to the limitations of the tool would be helpful.
By Mi Wu on 02/02/2016
Hi, looking at Lake Pontchartrain, I get results below zero. Could you try again and see if it does anything different?
By Daft Logic on 20/01/2016
nice work! I don't see the negative values around lake ponchartrain in New Orleans, just down to zero.
On 20/01/2016
Hi, this is the most relivant reference - https://groups.google.com/d/msg/google-maps-js-api-v3/KcjkS-U36dE/PBIutsUl5WEJ
By Daft Logic on 20/01/2016
Hi There! What is the datum/coordinate system you are using here? Thanks
On 20/01/2016
Hi Ron, It would be the land rather than the construction. The elevation data is generalised/averaged ... so it will not be precise enough for the purpose of finding elevation of construction such as this. In terms of where to find this data ... I'm not sure, but I have my doubts there is a worldwide one stop shop that has everything. You may find some city specific data perhaps?
By Daft Logic on 12/01/2016
Hello DaftLogic, I wanted to know whether the altitude reading displayed is the elevation of the land from the sea level or elevation of the construction at that spot(say roads or buildings)? If at all, how and where can I get the elevation readings for bridges/fly overs etc.? Thanks!
By Ron on 12/01/2016
Janet, not sure. The best answer i can give is "mean sea level", but this is on a world-wide basis.
By Daft Logic on 06/01/2016
You say height is above mean sea level. Is this Ordnance Datum at Newlyn?
By Janet on 04/01/2016
Superb
By SATHISH on 18/12/2015
Very Useful
On 16/12/2015
It should now be functioning correctly again.
By Daft Logic on 30/11/2015
Still broken, just so you know.
By Blah on 28/11/2015
Google Maps Find Altitude, as of yesterday Friday, Nov. 27, 2015 is no longer working on my computer. I love using the program and would like to fix the problem so it works again. Can somone on your end help? Email: TonyC5330@aol.com
By Tony Canta on 28/11/2015
This is NOT WORKING correctly. Don't use it guys. e.g. try 45 33.62909' N, 112 5.98931' W and compare it to Google Maps...
By Brian on 15/11/2015
Clever design, great idea, but it doesn't work with bridges. :) Trying to find the incline elevation and decline in feet on a bridge and map wasn't showing differnce in feet. Realized it wasn't accounting for the design of the bridge, which makes sense.
On 11/11/2015
Stumbled upon the website and it is extremely accurate and very easy to use. Looking to move to FL and this will be a great help in locating land sufficiently above sea level quickly. GREAT JOB.
By Jim on 10/11/2015
Who is the author?
By Valentin on 10/11/2015
Thanks for reporting. This should now be resolved. Please reload the page and try again.
By Daft Logic on 10/11/2015
From several days ago, after you press clear map button, latitude and longitude data are random, wherever you click
On 10/11/2015

30 out of 432 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!