21

I'm looking for open-source or publicly-available terrain data, for instance heightmaps or DEMs -- ideally GeoTIFFS by way of an easy-to-use API. For instance: you pass a pair of lat/longs and maybe a resolution, and are returned an image, possibly wrapped in some XML.

The sources I've found so far require complicated dances through maddening interfaces to acquire data, which further requires lots of manual labor to be made useful. Does my dream source exist?

[Edit: YES IT DOES, I helped make it. See my answer below]

  • "complicated dances through maddening interfaces" - yep - that's exactly what open data feels like. Seriously, you'll rarely find the data in exactly the form you want. Particularly, a straightforward service of map images in all places at all resolutions is unlikely to be available for free. – boisvert May 11 '13 at 11:17
  • Do you need for the entire world, or just some specific geographies? – fgregg May 11 '13 at 23:07
  • Ideally the whole world, but I'll settle for the SRTM dataset, for now. – meetar May 12 '13 at 14:56
  • Or ASTER. That would be good too. – meetar May 17 '13 at 19:27
  • 2
    have you tried naturalearthdata.com? i don't think there's an api, but there's alot of open data with a very easy to use site – albert Mar 5 '15 at 18:53
11

The Google Elevation API should allow you to access elevation data world-wide and allows you to give location as latitude/longitude.

What Can You Do With the Elevation API?

The Elevation API provides elevation data for all locations on the surface of the earth, including depth locations on the ocean floor (which return negative values). In those cases where Google does not possess exact elevation measurements at the precise location you request, the service will interpolate and return an averaged value using the four nearest locations.

It does have restrictions on its usage unfortunately - "the Elevation API may only be used in conjunction with displaying results on a Google map; using elevation data without displaying a map for which elevation data was requested is prohibited." - https://developers.google.com/maps/documentation/elevation/#Limits

  • Cool, I didn't know about that! But I'm looking for terrain data, not just per-point elevation. I've clarified the question in response to your answer, thanks for the help! – meetar May 10 '13 at 17:42
  • probably because google's api's aren't open source – albert Mar 5 '15 at 15:07
9

Check out the Cornell University Geospatial Information Repository. Admittedly not exactly what you are looking for, but if you want data on NYS you can at least download it easily, and it might be possible to automate it if you have the time to write a script.

I'm not sure what's available in other states, but this seems to be pretty par for the course when it comes to Geospatial data sets. Keeping this stuff up to date is a constant battle, so the maintainers often don't bother releasing a public version that will soon be out of date when they can just give you what you need on request.

I'd try out the GIS Stack Exchange. They are the real experts on this stuff.

  • Excellent suggestion, I'll attempt to move this question there. – meetar May 12 '13 at 14:58
  • @meetar The question is still on-topic here, so there's no need to move it. But if you have specific questions about working with maps, asking them on GIS would likely work well. – Adam Lear May 13 '13 at 15:15
7

It's not an API, but I just found the SRTM Tile Grabber, which is a minimal interface to mirrored, zipped, 90m SRTM tiles.

And better yet: "The files linked here are version 4.1 of an effort by the folks at CIAT-CSI to scrub, polish, and remove gaps in the raw SRTM data released by NASA."

Github repo: https://github.com/dwtkns/srtm-tile-grabber/

7

Past Self, I'm pleased to report that just after you asked this question, you were hired by a mapping company and worked on this exact thing, which was just released:

The Mapzen Elevation Tile Service is a free tile service which combines a variety of open-source terrain datasources into global elevation and normals tilesets, down to zooms 16 and 15, respectively.

Announcement post w/technical details: https://mapzen.com/blog/elevation/

Demos (made by you): https://mapzen.com/blog/mapping-mountains/

Interactive Global Heightmap: https://github.com/tangrams/heightmapper

Enjoy,
Current Self

  • 1
    please repeat this process around difficult technical problems as soon as possible. – albert Jun 2 '16 at 2:49
  • 1
    This is THE BEST! Thank you, @meetar for coming back to post this. I've been searching all day and Mapzen is my "impossible" dream, come true. – Robbie Wxyz Jul 19 '16 at 5:39
6

I've recently released a new version of my Data Science Toolkit API that supports elevation queries:

Here's an example call:

[
  {
    "location": {
      "latitude": 37.769456,
      "longitude": -122.429128
    },
    "statistics": {
      "elevation": {
        "value": 40,
        "source_name": "NASA and the CGIAR Consortium for Spatial Information",
        "units": "meters",
        "description": "The height of the surface above sea level at this point."
      }
    }
  }
]

You can spin up your own EC2 or Vagrant VM if you want to run it locally, and the docs/ec2setup.txt will walk you through the process I went through to import the data, which may help if you want to roll your own version instead. PostGIS's new raster support was a massive help.

Sorry, missed your geotiff requirement initially - you might want to download the SRTM source I used at srtm.csi.cgiar.org as three large GeoTIFFs and then tile them up.

  • This is just per-point elevation, not terrain maps, correct? And GeoTIFFs aren't a requirement, just one possible ideal. – meetar May 21 '13 at 21:50
  • 2
    That's correct, though with no API limits beyond machine speed, you can make gridded calls to build up an image. You could also bypass the API layer and make PostGres/GIS SQL calls directly to grab a bounding-box of samples. – Pete Warden May 21 '13 at 21:57
  • @PeteWarden (I know this is a very old post, but still :-) ) Hi, i just gave your awesome API a try. I wanted to use it inside an open source project chrome extension. Problem is that the page it has to run uses HTTPS and your API only supports HTTP, right? Unfortunately this is not allowed due to security reasons. Is there any way to request the JSON data via HTTPS? – L.Butz Sep 10 '16 at 8:23
3

I would guess the the US Geographic Survey would have this, though they have so much, it can be difficult to navigate. Fortunately, the recently launched www.doi.gov/developer helps give an overview of places to look.

(Disclaimer - I am the Sr. API Strategist for GSA)

3

Here is the another API that I`ve built with examples for different languages. For example, on Python you can call it up like this:

import Algorithmia

input = {
    "lat": "50.2111",
    "lon": "18.1233"
}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('Gaploid/Elevation/0.3.0')
print algo.pipe(input)
#{ "elev": "201" }
2

In terms of API:

  • Check out the GDAL/OGR library. They have python/c/c++ interfaces. http://gdal.org

In terms of data:

  • GMTED2010 goes down to 7.5 arcsecond grid spacing.
  • SRTM goes down to 3 arcsecond grid spacing.
  • NED goes down to 1 arcsecond grid spacing, but it only covers US & territories.

Several state agencies have their own terrain data for download as well.

2

I'd like to contribute yet another API to this list. Open-Elevation is a free and open-source elevation API also available at Github.

While you can certainly host your own instance, there's a free public API .

There's also documentation on how to set it up with your own data, although I admit that, since it is in its infancy, it is a bit rough around the edges. Pull requests are welcome!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.