What would be the best way to get elevation of a coordinate out of a PostGIS database (SQL/plpgsql) given a GeoTIFF dtm file?

Importing as PostGIS Raster (which seems more costly) and calling ST_Value?

Use pgsql-http (https://github.com/pramsey/pgsql-http ) and a cgi which calls gdallocationinfo (GDAL)? Or using pgsql-http to call GDAL/WCS? Other?

  • What has the database got to do with it? Are you trying to emulate the Esri tool 'sample' which gets the value for each point in the feature class? Is this a one-off or is it for a process that could be called at any time? Are you open to python/C#/C++/Java/Other.. solutions or is it important to be executed within the database by SQL? – Michael Stimson Mar 19 '15 at 2:54
  • PostGIS raster feels like a clean solution for heavy load but the gdallocationinfo way is a nice trick and you do not need to import DTM data into database. A third option could be to set up a WMS service for DTM and send GetFeatureInfo requests through pgsql-http demo.opengeo.org/geoserver/usgs/… – user30184 Mar 19 '15 at 7:48
  • Thanks user30184. Nice hint to WMS GetFeatureInfo. I've actually found Foreign Data Wrapper www_fdw (github.com/cyga/www_fdw ) which could do the main job, calling any webservice. – Stefan Mar 19 '15 at 19:21
  • Michael Miles-Stimson: Yes, seems to be similar to getting a value for point features. It's a process called from time to time when for thousands of features. That's why external webservices (like elevation-service from Mapquest) are no option. – Stefan Mar 19 '15 at 19:35

Your Answer

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

Browse other questions tagged or ask your own question.