4

I have a shapefile with 31 million polygons and I want to extract statistics from a raster for each polygon. Whenever I use zonal statistics I get:

ERROR 999998: Unexpected Error. Failed to execute (Zonal Statistics)

The problem with this error is that there is no clear answer on what is going wrong.

So far I tried breaking the shapefile into smaller pieces and run zonal statistics, changed the processing from background to foreground and changed my working directory to C:/ but I keep getting the same error.

I would like to know what else can I try?

  • 4
    Are your polygons overlapping? If not, have you tried manually converting your input polygons to raster? See the docs – Barbarossa Mar 16 '16 at 19:11
  • Thanks for your answer, there are no overlapping polygons. Now I'm converting my polygons to raster but it should take some time before I can test if it works. – pef frank Mar 16 '16 at 19:34
  • 1
    From ESRI's help on zonal stats: "If the zone input is a feature dataset, a vector-to-raster conversion will be internally applied to it". You might as well do it yourself and be in total control of the settings. Plus, it will help you to isolate any unknown errors. – Tom Mar 16 '16 at 19:40
  • 1
    Be extremely careful with the cell size, it could be size of the raster causing problems. You might try this gis.stackexchange.com/questions/112946/… it works for overlapping polygons, should work in your case – FelixIP Mar 17 '16 at 1:06
  • Thank you very much guys that was it. I converted the polygons to raster manually, the size of the raster was a bit tricky but in the end it worked. – pef frank Mar 18 '16 at 11:18
1

In ArcGIS you could try running Data Management Tools>Features>Check Geometry first (and Repair Geometry if needed). You could also try using Zonal Statistics in QGIS (it also has a repair geometry -kind-of-function).

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.