G'day everyone
I am trying to get some altitude data about 700 points that I have. I thought I could use the code provided on the same question ( Conversion for latitude / longitude in height to R ), unfortunately, I get errors when using the geonames package, and the website for which the best answer is provided does not contain Australian height data (errors are indicated below FYI).
I found another website that provides very accurate altitude data for Australia, but I have no idea how I can extract information from the webpage. I think it uses google heights API, but again I have no idea how to access this.
When I put the coordinates "lat, lon" in the "location search" field, it gives the height data below the map. However, I cannot find this on the original page. Website http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm .
some examples of lon lat that work:
-36.0736, 146.9442
-36.0491, 146.4622
I am wondering if someone can help me fetch this site from R and extract height data? Or does this seem like most of the hassle? I understand that the website has a batch function (up to 100 locations), but it would be great to do this with R.
Thanks everyone, sorry if this is very obvious.
Cheers, Adam
ERRORS
When using geonames:
elevation <- GNgtopo30(adult$lat, adult$lon)
Error in getJson("gtopo30JSON", list(lat = lat, lng = lng)) :
error code 10 from server: Please add a username to each call in order for geonames to be able to identify the calling application and count the credits usage.
In addition: Warning message:
In readLines(u) :
incomplete final line found on 'http://ws.geonames.org/gtopo30JSON? lat=-36.0736&lng=146.9442'
When using a request code:
library(RCurl)
library(XML)
url <- paste("http://earthtools.org/height", adult$lat, adult$lon, sep = '/')
page <- getURL(url)
ans <- xmlTreeParse(page, useInternalNodes = TRUE)
Space required after the Public Identifier
SystemLiteral " or ' expected
SYSTEM or PUBLIC, the URI is missing
Extra content at the end of the document
Error: 1: Space required after the Public Identifier
2: SystemLiteral " or ' expected
3: SYSTEM or PUBLIC, the URI is missing
4: Extra content at the end of the document