0

I am trying to do zonal stat in PostGIS with the following command.

SELECT
    (ST_SummaryStats(ST_Clip(agri_final_proj.rast, district.geom, TRUE))).*,
    district.district_1 AS district_1,
    district.geom AS geom
INTO
    regions_with_elevation
FROM
    agri_final_proj, district;

Here agri_final_proj is my raster and district is my vector file. But when running the query I am facing this issue:

"ERROR:  lwgeom_intersection: GEOS Error: TopologyException: Input geom 1 is invalid: Ring Self-intersection at or near point 458031.90649999958 4166648.6541000009 at 458031.90649999958 4166648.6541000009"
0

It looks like your input geometry is invalid at a certain point (Check coordinates in error message). Also you can check if your vector data-geometry is valid with ST_IsValid() https://postgis.net/docs/ST_IsValid.html, if not you can try to solve this problem with ST_MakeValid()https://postgis.net/docs/ST_MakeValid.html . For more information about valid geometry construction in PostGIS check following link: PostGIS Validity

| improve this answer | |

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.