[postgis-users] Raster Points in Polygon (was Re: PostGIS Raster for Met Data)

Michael Akinde michael.akinde at met.no
Wed Aug 24 06:46:04 PDT 2011


Hi,

Vacation time's over, and I'm experimenting with this again.

----- Original Message -----
> > Not quite - I was thinking more of World2RasterCoord, but using a
> > geometry to extract multiple raster points. Essentially, ST_INTERSECT, but
> > returning raster coordinates rather than world coordinates and value.
>
> You can extract every point of a complex geometry using a mixture of
> ST_PointN(),ST_NPoints(),ST_NumGeometries() and ST_GeometryN(). Have a
> look in the PostGIS doc.

I'm probably not getting across exactly what I want to do. I'll try to give an example:

Given a raster rast, e.g., 
st_makeemptyraster( 850, 1100, -6.7390, -16.0390, 0.036, 0.036, 0, 0, 900917 )

I would like to query the raster using a geom, e.g., ST_GeomFromText('Polygon((10 60, 11 60, 11 61, 10 61, 10 60 ))', 4030) transformed to the appropriate SRID (900917 in this case) and return the result as a set of rows with RasterCoordX/RasterCoordY for each raster point in the polygon.

As an alternative, retrieving the set of point values stored in the raster would work if we could extract as POINT/pixel-value pairs. I suppose I may have stared myself blind on this problem, but I haven't found any obvious way to do this operation. Is it doable in any form of reasonable manner, and if so - can someone point me in the relevant direction?

Regards,

Michael A.



More information about the postgis-users mailing list