0

I am working with GeoServer 2.22 and I'm trying to use the gs:RasterZonalStatistics tool, through the WPS request builder that is provided in the "demos" in GeoServer. The tool runs fine when I use as input for the "zones - Zone polygon features for which to compute statistics" an shapefile.

My problem is that I want to use as input either JSON or preferably the text/csv option, and the output is empty. I have checked that my coordinates are in the same CRS as my raster and that the coordinates are given counterclockwise and that the polygon is closed.

When I use JSON, I format it as:

{"type": "Polygon", "coordinates": [[[92463.16443053566, 453115.6121168173],[91863.11388721458, 451418.7404136644],[93069.6374807694, 451221.9515308621],[93421.14967336296, 452890.0222223025], [92463.16443053566, 453115.6121168173]]]} 

When I use text/csv, I format it as:

FID,the_geom
1,POLYGON(((92463.16443053566 453115.6121168173,91863.11388721458 451418.7404136644,93069.6374807694 451221.9515308621,93421.14967336296 452890.0222223025, 92463.16443053566 453115.6121168173))
2
  • 1
    That's wkt not csv
    – Ian Turton
    Apr 21, 2023 at 11:38
  • yes, thank you for the remark. i also tried with the altered code.
    – Elen
    Apr 21, 2023 at 14:00

1 Answer 1

0

The RasterZonalStatistics process is expecting a FeatureCollection rather than a simple polygon which is why your early attempts didn't work. I suspect that the problem with the CSV import is that it isn't quite smart enough to automatically detect that you are passing in a WKT geometry column, it's been a while since I looked at that code but as I recall it was mostly expecting to see an X and Y or Lat and Lon column and if it didn't see those it would proceed with no geometry column.

I would stick to use better supported formats with the WPS engine.

1
  • Thank you for your answer! Indeed it needed the '''FeatureCollection''' . It works in JSON format with: {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[x1,y1],[x2,y2],[x3,y3],[x4,y4],[x1,y1]]]]}}]}
    – Elen
    Apr 26, 2023 at 7:32

Your Answer

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

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