Logic, but in a different way

Daft Logic

Google Maps Find Altitude

Last Updated 21st March 2009

Quick Find :

[Map Height : Small - Medium - Large]

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

How it Works

var mapDiv=document.getElementById('mapDiv');
var map;
function Gload()
{
mapDiv.innerHTML='Loading ...';
if(!GBrowserIsCompatible())
{
mapDiv.innerHTML='Sorry, your browser is not compatible with Google Maps.';
return;
}
map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.setCenter(new GLatLng(0,0), 2);
map.setMapType(G_HYBRID_MAP);

GEvent.addListener(map, "click", function(overlay,point,overlaylatlng)
{
if(point)
{
mapDiv.innerHTML="Finding Altitude...";
map.addOverlay(createMarker(point));
findalt(point);
}
});
mapDiv.innerHTML="Ready";
}
function findalt(point)
{
var script = document.createElement("script");
document.body.appendChild(script);
var selectedWebService="gtopo30";
script.src = "http://ws.geonames.org/" + selectedWebService + "JSON?lat=" + point.lat() + "&lng=" + point.lng() + "&callback=loadJSON";
}
function loadJSON(result)
{
var filter = new Array();
filter[0] = "gtopo30";
var output=JSON.stringify(result,filter);
var output2=JSON.parse(output);
mapDiv.innerHTML =output2.gtopo30+"m";
}
function createMarker(point)
{
var marker=new GMarker(point);
return marker;
}
function ClearMap()
{
map.clearOverlays();
mapDiv.innerHTML="";
}

Relevant Links

http://www.geonames.org/

Further Uses and Ideas

Version History

Previous Comments For This Page

A reading in feet and metric would be helpful for the US.
By DMWilson on 14/11/2009
Kindly update satelite image its four year old. September 26, 2009
By Jebran, Karachi, Pakistan on 26/09/2009
Folks, the accuracy level of this is "close enough." From the documentation of geonames.org service Daft is using - "GTOPO30 is a global digital elevation model...with a horizontal grid spacing of...approximately 1 kilometer." In other words, they haven't measured every "point", so don't expect pinpoint accuracy here, especially in areas of rapid elevation gain/loss. Great job, DAFT!
By A Fellow Programmer on 22/09/2009
Why is Mount Everest much lower here than what it actually is. On here it shows 8752 metres when it should be about 100 metres higher?
By Wendy on 13/09/2009
As per the last persons comment, these altitudes are not correct.
By Alan on 13/09/2009
Super Cool! Thanks for creating.
By Atheist Slayer on 27/08/2009
very cool! how can i send a link to someone? btw, i live in the usa, and i vote for metric!
On 12/08/2009
It would be great to be able to print the map for travelling purposes!
By Dr T on 10/08/2009
If people don't like metres, just convert it to feet. Thanks for this page.
By James on 05/08/2009
how come there is no "feet measurements"? it would be nice to have both systems...including the metric system, Paul
On 03/08/2009
Are there any other websites to find altitude for pinpoint locations? Some comments suggest this Daft may not be accurate...
By Steve in Minnesota on 03/08/2009
Nice idea. What is the expected accuracy? I've clicked places I know are at least 5 meters difference and they read the same altitude.
By Craig on 28/07/2009
The metric system rules. Get with the rest of the world, America. Come into the 21st century.
On 20/06/2009
were in the US, feet, yards and miles are our unit of measure. I don't need to know metric
On 18/06/2009
i hate the metric system.
By America FTW on 14/06/2009
Latest ff-3.0.10 here. No map displayed - only a blank white area, resizable using the Small, Medium, Large options. Two definite errors reported: "GlocalSearch is not defined" and "mapDiv is undefined". Interesting.
By Nefi on 20/05/2009
sort it out this gave me same hight at to locations that are at 50 to 60m higher or lower than the other.technology just not there yet for us poor civies
On 14/05/2009
Need in feet as well
By brian in NYC on 08/05/2009
doesn't work for me
On 27/04/2009
works great. Thanks
By Bobby on 14/04/2009
lake taupo is at 356m according to the wiki but this gives from 308 to 338 at various points on the surface of the lake.
By roger on 31/03/2009
even more confused
By cookie on 20/03/2009
worked well, thank you
On 13/03/2009
So the highest point on the hill above us reads 56m and down here toward the bottom (at least 80 to 100 feet lower) reads 60m. Worthless info ? seems to me!
By Guy on 19/02/2009
Good help, but you'd have to wonder why we can't just do this on google maps? Daft. Cheer.
By Jason on 12/02/2009
It worked for me.
By Bill on 11/01/2009
Message box below the map?
By Mike on 11/01/2009
Doesn't seem to work - gives me the same altitude at the top of a nearby hill as at the bottom!
By Neil on 06/01/2009
Hi, Try the new quick find option to see if it works any better.
By Daft Logic on 29/12/2008
It is too slow. It would be better if I can enter my address. I'm baking a cake and I need to know the altitude for the Oakland hills, CA.
On 29/12/2008

30 out of 34 comments shown. See all comments.

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

Comments :

Your Name (optional) :