Killing Godzillas using Arcpy

2449855712_7f12111bc7_z

According to Esri , Godzillas are those geometries with too many vertices that cause errors like out-of-memory, system crashes or the “famous”  999999 : Error executing function.

To avoid that problem you will have to use the Dice tool. That tool “Subdivides a feature into smaller features based on a specified vertex limit*. (Only available to  “Arcinfo” , “ArcGIS for Desktop Advanced”  or “Arcgis for Server Advanced” users).

For example, if you have some geometries like these:

despues (1)

and apply them the Dice tool, you will get results like these:

despues_dice (1)

The only problem is that the Dice tool could generate some invalid geometries (and the docs don’t tell you about it).  Alternatives?  Python / Arcpy to the rescue.

The following script does the following:

  • Convert you features from multipart to singlepart.
  • Dice your geometries
  • Teplace the old data with the new generated features
  • Check and  repair the new  invalid features

Easy, isn’t it?. You can tame those ugly godzillas with a little bit of python / arcpy.

2449853812_9a3578720f_m

If you need to do something similar using open source software, probably the best option is the function “ST_SubDivide” from postgis. The following post from Paul Ramsey gives you more details about it: “Subdivide All the Things“.

 

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s