title: Extracting elevation from website for lat/lon points in Australia, using R
body: <p>G'day Everyone,</p>
  
  <p>I am trying to get some elevation data for about 700 points I have. I thought I might use the code provided to the same question (<a href="https://stackoverflow.com/questions/8973695/conversion-for-latitude-longitude-to-altitude-in-r">Conversion for latitude/longitude to altitude in R</a>), unfortunately I get errors when using the geonames package, and the website the best answer provides does not have Australian elevation data available (Errors provided below FYI). </p>
  
  <p>I found another website which provides very accurate elevation data for Australia, but I have no idea how I might extract the information from the webpage . I think it is using the google elevation API, but again I have no idea how to access that.</p>
  
  <p>When I put 'lat, lon' coordinates into the 'search for location' box it gives the elevation data below the map. However, I can't seem to find this in the source page. The website is <a href="http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm" rel="nofollow noreferrer">http://www.daftlogic.com/sandbox-google-maps-find-altitude.htm</a>.</p>
  
  <p>some example lon lat values that work:</p>
  
  <p>-36.0736, 146.9442</p>
  
  <p>-36.0491, 146.4622</p>
  
  <p>I am wondering if anyone can help me query this site from R, and extract the elevation data? Or does it seem like to much of a hassle? I realise there is a batch function (up to 100 locations) on the website, but it would be cool to be able to do this from R. </p>
  
  <p>Thanks everyone, sorry if this is extremely obvious.</p>
  
  <p>Cheers,
  Adam</p>
  
  <p><strong>ERRORS</strong></p>
  
  <p>When using geonames:   </p>
  
  <pre><code>elevation &lt;- 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&amp;lng=146.9442'
  </code></pre>
  
  <p>When using query code:</p>
  
  <pre><code>library(RCurl)
  library(XML)
  url &lt;- paste("http://earthtools.org/height", adult$lat, adult$lon, sep = '/')
  page &lt;- getURL(url)
  ans &lt;- 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
  </code></pre>