WiGLE is a popular platform which can be used for finding the location of a device using the names of WiFi networks in its vicinity. I’ve written about this before, and wrote some Python code to interact with their API. This API has since been retired and replaced with a new one, as of December […]
Ever needed to find the height above sea level? Here’s a method to pull altitude data into Excel either from latitude and longitude, or a city name, address, postcode, or anything else that resolves to a location on Google Maps.
Seeing as the various Google Maps API posts on here seem to be so popular, when I saw Google’s elevation API I thought it should probably join distance, journey time and latitude & longitude in having an Excel function written for it.
It’s not that difficult. The form is pretty much the same as the others so I’ll just put it here.
Function G_ELEVATION(LatLng As String) As Double
' Requires a reference to Microsoft XML, v3.0 or greater
Dim myRequest As XMLHTTP60
Dim myDomDoc As DOMDocument60
Dim elevationNode As IXMLDOMNode
G_ELEVATION = 0
' Check and clean inputs
On Error GoTo exitRoute
' Read the XML data from the Google Maps API
Set myRequest = New XMLHTTP60
myRequest.Open "GET", "http://maps.googleapis.com/maps/api/elevation/xml?" _
& "&locations=" & LatLng & "&sensor=false", False
' Make the XML readable usign XPath
Set myDomDoc = New DOMDocument60
' Get the elevation node value
Set elevationNode = myDomDoc.SelectSingleNode("//result/elevation")
If Not elevationNode Is Nothing Then G_ELEVATION = elevationNode.Text
' Tidy up
Set elevationNode = Nothing
Set myDomDoc = Nothing
Set myRequest = Nothing
To call it just enter
=G_ELEVATION(LatLng) in a cell.
LatLng there should be a reference to a cell which contains a latitude and longitude in the form “0.0000000,0.0000000”. If your latitude and longitude are in separate cells can use
You could even daisy-chain it with the latitude and longitude function like
=G_ELEVATION(G_LATLNG("London, England")) to return London’s height above see level. It’s 20.23 meters, apparently.