[postgis-users] ST_Value on tiled raster
Bborie Park
dustymugs at gmail.com
Tue Apr 21 09:42:21 PDT 2015
Yes. The result of that query is the value for the first pixel. If you're
going to dump out all the values of all tiles, you're better off with
something like ST_DumpValues instead...
http://postgis.net/docs/manual-2.1/RT_ST_DumpValues.html
If you're scanning the whole MODIS scene(s), nothing beats the performance
of directly going to the files.
Since you're new, two bits of advice...
1. If your raster data is read-only, keep the raster data outside the
database using out-db (raster2pgsql's -R flag)
2. There is no optimal tile size for storing data in-db as that is highly
dependent on the source raster data (# of bands, pixel types of each band).
For out-db though, I strongly recommend using the block size specified by
the output of gdalinfo. The reason for this is that GDAL is used to get the
data from the out-db raster.
$ gdalinfo myraster.tif
Driver: GTiff/GeoTIFF
Files: myraster.tif
Size is 1405, 621
Coordinate System is:
GEOGCS["NAD83",
DATUM["North_American_Datum_1983",
SPHEROID["GRS 1980",6378137,298.2572221010002,
AUTHORITY["EPSG","7019"]],
AUTHORITY["EPSG","6269"]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433],
AUTHORITY["EPSG","4269"]]
Origin = (-125.020833333333329,49.937500000002032)
Pixel Size = (0.041666666666670,-0.041666666666670)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=BAND
Corner Coordinates:
Upper Left (-125.0208333, 49.9375000) (125d 1'15.00"W, 49d56'15.00"N)
Lower Left (-125.0208333, 24.0625000) (125d 1'15.00"W, 24d 3'45.00"N)
Upper Right ( -66.4791667, 49.9375000) ( 66d28'45.00"W, 49d56'15.00"N)
Lower Right ( -66.4791667, 24.0625000) ( 66d28'45.00"W, 24d 3'45.00"N)
Center ( -95.7500000, 37.0000000) ( 95d45' 0.00"W, 37d 0' 0.00"N)
Band 1 *Block=1405x1* Type=Float32, ColorInterp=Gray
Min=10.920 Max=49.370
Minimum=10.920, Maximum=49.370, Mean=29.345, StdDev=5.782
NoData Value=-9999
-bborie
On Tue, Apr 21, 2015 at 9:18 AM, Albury, Carl -FS <calbury at fs.fed.us> wrote:
> Hi
>
> I’m new to PostGIS so please bear with me.
>
> I’m working with MODIS data that I tiled using the auto tile switch in
> raster2pgsql resulting in 13250 82x94 tiles.
>
> When I try to query for pixel values using ST_Value, such as:
>
>
>
> SELECT
>
> ST_Value(rast, 2, 1,1) -- multiband raster
>
> FROM
>
> MODIS_test;
>
>
>
> I get a value for each tile, not for each pixel (I assume the value is for
> the first pixel in the tile?).
>
> If I want to query each pixel do I need to loop through each tile and have
> a sub loop for each pixel in that tile? If so I can’t figure out the syntax
> to designate the tiles vs pixels.
>
>
>
> Thanks very much,
>
> Carl
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20150421/2ff9ee9d/attachment.html>
More information about the postgis-users
mailing list