2

Is there an inverse function of ST_RasterToWorldCoord() in PostGIS (or the underlying GEOS/gdal), which, given the coordinates of a point in the raster's SRS, returns its row and column number?

I searched terms st_worldcoordtoraster and found nothing. I imagine it is not too difficult to write such a conversion function, but just wanted to ask here to avoid reinventing the wheel.

(I'm using the latest PostGIS 3.3 beta)

0

1 Answer 1

3

That would be ST_WorldToRasterCoord:

record ST_WorldToRasterCoord(raster rast, geometry pt);

record ST_WorldToRasterCoord(raster rast, double precision longitude, double precision latitude);

Returns the upper left corner as column and row given geometric X and Y (longitude and latitude) or a point geometry. [...]


References:

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.