Logic, but in a different way

Daft Logic

Google Maps Find Altitude

Last Updated 4th December 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

worthless
On 24/07/2010
This is great. Thanks!
By Jeff Edwards on 08/07/2010
It's not right in Riverside, CA Mt Rubidoux
On 04/07/2010
how do i find my height above sea level?somebody please help
On 18/06/2010
Why is it taking forever to repeat a request today that took no more than 10 seconds yesterday. In fact it has been 10 minutes and no result.
On 12/06/2010
Just put a pin into the Beach at Woolacombe Bay, Devon UK and gave showed an altitude reading of 292feet above Sea level. Last time I looked there wasn't that kind of drop to the Sea!!!!!
By Andy on 26/05/2010
Using feet and inches is great for building -- it lets you easily divide by 2, 3, and 4. I can't tell you how often I've been building something that I needed to trisect a measurement. It was easier than pi with the US Customary System (1 foot / 3 = 4 inches, 1 yard / 3 = 1 foot, 1 yard / 4 = 9 inches). That would have been a real pain in the metric system. The metric system is full of a bunch of lengthy decimals instead of concise fractions and short numbers (2 feet is 60.96 centimeters). The metric system of measuring the length of things is literally a royal pain.
On 23/05/2010
False results for me in France : my test was done on a point which is about 300 meters, and the software gives me 38 meters. It's good only for approximate results, on very large maps.
By Mathilde D on 29/04/2010
supercool . . , considering 10 years ago, we shouldn't complain!!
On 10/04/2010
Altitude or Elevation? I think this should be Elevation (reference from sea level)
By MKD on 06/04/2010
gtopo30 accuracy is 1km x 1 km. Theoretically, for more accuracy you can use srtm3, that should be 90m x 90m, or astergdem, that should be 30m x 30m. But great job anyways! Greetings from Lithuania! ;]
By DonatasJ on 26/03/2010
I'm on the ocean in San Francisco and said my location was -9999M - I'm not a fish !!!
On 27/02/2010
'Looks to me like comment #9 above by "By A Fellow Programmer on 22/09/2009" explains it best... Great job, DAFT! Surfer Steve
On 27/01/2010
CCR, This has now been fixed.
By Daft Logic on 07/01/2010
I get a weird message: The page at http://www.daftlogic.com says: IMPORTANT: Remove this line from json2.js before deployment. What does it mean?
By CCR on 07/01/2010
One of the other comments said the elevation data has 1 km resolution. If so, PLEASE don't let us enlarge the Google map down to meter resolution. That makes no sense.
By Andy I. on 31/12/2009
I tried it out on my town ... and the results are just plain wrong! A small hill comes up lower than the valley next to it. The top of the highest hill in town is no higher than the lowlands around it. My guess is the database you got your elevations from, is either wrong, or has very poor resolution (relative to the Google map) so that clicking on nearby objects is meaningless, resulting in bogus relative elevations. It is showing an 8 meter (26 foot) difference in elevation between points on the same pond. I don't think so. So I think this application should come with a warning that the results are VERY approximate and sometimes plain wrong. I know there is much better elevation data out there. Another website tool showed me realistic variations for points on my own property, which this application doesn't do.
By Andy I. on 31/12/2009
could you make altitude finder read in feet?
By Greg K on 03/12/2009
where is it? where is it? Junk!
On 22/11/2009
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

30 out of 53 comments shown. See all comments.

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

Comments :

Your Name (optional) :