News for hackers. Stuff that matters.
Re:Why you should not pirate Google’s geo APIs by Doctor_Fegg on Tuesday September 10, 2013 @04:02AM (#6358780)
Building your own elevation API is absolutely trivial; I don't know why anyone would even want to pirate Google's API for large-scale usage.

Firstly, the data is freely available. It's NASA's SRTM [1], downloadable from a zillion mirror sites.

Then just take some code to calculate a lat/long offset and find the right position in the right tile. Bob Osola has some easily portable PHP for this if you need it [2].

Free hint: Putting both your tiles and your (Lua) lookup code in Redis, then calling the latter with EVALSHA, is a really neat and fast way to do this.

If you really need ocean depths, higher resolutions than SRTM offers, or stuff above 60 degrees latitude, then it gets a little more complex. But for 90% of cases doing it yourself is eminently practicable.

[1] http://www2.jpl.nasa.gov/srtm/ [2] http://www.osola.org.uk/elevations/

Re:Why you should not pirate Google’s geo APIs by hackula1 on Tuesday September 10, 2013 @11:23AM (#6360555)
Building a robust elevation api is definitely not trivial for the average dev using the google api. If someone thought the only way to get elevations was through google then they definitely will not know how to find and compile the data, then write the TIN (triangulated irregular network) algos necessary to appropriately estimate the elevation of an arbitrary point. No, it is not that hard, since tools like Grass can do a lot of the TINing stuff for you, but just running Grass, much less scripting it, is not trivial for someone unfamiliar with GIS. Making this stuff stable and performant on a server (as opposed to a one off calculation on a dataset) is also not trivial in the least.
Re:Why you should not pirate Google’s geo APIs by Doctor_Fegg on Tuesday September 10, 2013 @11:54AM (#6360794)
Worrying about TIN is the 10% case. Simple interpolation within SRTM raster tiles is all that's needed for 90% of cases (IMHO, obviously).
Re:Why you should not pirate Google’s geo APIs by hackula1 on Tuesday September 10, 2013 @12:24PM (#6361053)
I would not think interpolation would be that much easier than a creating a TIN. I have not looked at the dataset though, so it might be "pre-interpolated" (probably using a TIN if I had to guess), in which case this would be pretty easy with something like pyqgis on a flask server or whatever. The entire api could basically just be:

    @app.route("/elevation")
    def elevation():
      fileName = "/path/to/raster/srtmRaster.tif"
      fileInfo = QFileInfo(fileName)
      baseName = fileInfo.baseName()
      srtmRaster = QgsRasterLayer(fileName, baseName)
      res, ident = srtmRaster.identify(QgsPoint(request.form['lat'], request.form['lon']))
      return ident[0]
I can test this out and throw it on github with some polish if anyone is interested.
Re:Why you should not pirate Google’s geo APIs by chii on Tuesday September 10, 2013 @07:40AM (#6359403)
interesting. I think of these data are freely available, then there ought to be more people using it and making competing versions so that google will not have a monopoly on provision of such data apis.
Re:Why you should not pirate Google’s geo APIs by hnal943 on Tuesday September 10, 2013 @10:23AM (#6360164)
Don't wait for "other people;" if you think it should be done, I'd encourage you to do it yourself!
Re:Why you should not pirate Google’s geo APIs by Sprint on Tuesday September 10, 2013 @12:05PM (#6360903)
How do you know it is just SRTM?
Re:Why you should not pirate Google’s geo APIs by Doctor_Fegg on Tuesday September 10, 2013 @12:33PM (#6361118)
Sorry, should have made myself clearer. I'm not saying that Google just uses SRTM - I'm sure they throw lots of other sources and general Google Magick in there. But for most people in most places, SRTM is good enough.
Re:Why you should not pirate Google’s geo APIs by Sprint on Thursday September 12, 2013 @05:22AM (#6372992)
np and cheers!

Yeah, I think so too. And querying SRTM tiles is prerry simple.