I need to extract all pixel values in a raster within a GeoJSON mask, using ST_Intersects.

Attempt (throws invalid GeoJson representation):

select row_to_json(t) from (select * from table_name where st_intersects(st_transform(st_setsrid(ST_geomfromgeojson('{"type":"FeatureCollection","features": []}'), 4326), 3857), rast)) as t;

It seems FeatureCollection type GeoJSON is not straight-forward. How can I wrap this?

  • The GeoJSON is a dummy, obviously. A simple polygon like this throws the same error.
    – knutole
    May 9, 2016 at 16:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.