I have done:
- Import a SHP file into PostGIS by PostGIS SHP loader GUI.
Import a raster into PostGIS:
\raster2pgsql -I -s 4326 landsat.TIF -t 500x500 public.landsat > query.sql
After importing all into postGIS, I have tried exporting raster to PNG by ST_AsPNG. It run well. Besides, I run the example of ST_Clip() in PostGIS docs. It worked.
Question: I am trying to clip a raster with a polygon of the SHP file. It returns nothing.
I tried ST_Intersects(rast, geom polygon) like this. It failed.
Can anyone help me on clipping a raster with a pylygon of SHP file?
Viewing in QGIS, the raster overlaps the polygon. I'm using PostGIS 2.0.
EDIT: Here's what I do with ST_Intersects()
SELECT
ST_Intersects(polygon.geom, raster.rast)
FROM
public.vnm_adm2 as polygon,
public.landsat as raster;
And it returns false in all rows.
UPDATE: There're some things to be noted here:
- I used ST_AsPNG(), which remove spatial reference to output file.
- Switch -s [4326] doesn't work yet (PostGIS 2.0), so the rasters ain't be converted to polygon's EPSG, then it returns false in all rows.


