[postgis-users] Retrieving Data from PostGIS Raster using ST_Value

elliott elliott at cpi.com
Thu Oct 13 06:38:04 PDT 2011


The table contains SRTM3 data.  What I would really like to do is 
retrieve the altitude for any given lat/lon.  We currently have 
scientific codes that read the SRTM3 flat file into an array and 
interpolate the value for the lat/lon pair.  We would like to retrieve 
the data from a database instead of flat file thinking the performance 
would be better.  However, the times retrieving the array from the 
database are many orders of magnitude worse than just reading the array 
in from a flat file.

On 10/12/2011 8:34 PM, Pierre Racine wrote:
> If you want to get all the values for every pixel do:
>
> SELECT (ST_DumpAsPolyogns(rast)).val
> FROM your table
>
> Can I ask why you want to do that? Normally people want to extract values intersecting with a polygon or a point.
>
> You can also get the histogram of the raster using ST_Histogram().
>
> Pierre
> ________________________________________
> From: postgis-users-bounces at postgis.refractions.net [postgis-users-bounces at postgis.refractions.net] On Behalf Of elliott [elliott at cpi.com]
> Sent: Wednesday, October 12, 2011 9:04 AM
> To: PostGIS Users Discussion
> Subject: [postgis-users] Retrieving Data from PostGIS Raster using ST_Value
>
> Hello Everyone,
>
> I am very new to using PostGIS Raster.  I need to retrieve data fields
> from a tile loaded into the database.  Using ST_Height and ST_Width, I
> get the number of rows and columns and iterate over these using the
> ST_Value to retrieve the data.  This is extremely slow taking 1/2 hour
> to get all of the data required.  Is there a faster way to accomplish this?
>
> Thanks!
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>    




More information about the postgis-users mailing list