Killing Godzillas using Arcpy


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.


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“.


Palabras sabias de reflexión: Qué debo tener en cuenta para iniciar un proyecto SIG (Sistema de Información Geográfica) en el 2014


Tomado de Starting a GIS :

If you are starting a GIS please consider the following:

  • Decide what data you need. Does it exist already? Do you need to go out and collect it? Can you collect it or do you need to hire someone to do it.
  • Look at your software needs. How much do you want to spend. Look at open source. Look at the commercial stuff. Can you mix and stretch those dollars just a bit more than you think? BTW – you can mix and match. All you need is a process.
  • Budget – Budget for a year. Budget for two. Then Budget for five. Budget like this might be successful. Look at your software also. Are you going to spend enough on software you could hire someone else? It happens. That’s a huge argument (for me) for mixing in open source. Jobs. Hiring someone does more for your community than paying more money for software.

It’s 2014. Software doesn’t have to be from one vendor. Your entire GIS setup doesn’t have to be a mono-culture. Servers (think cloud (another word I hate)) are cheaper than they ever have been. Pick the right software and you don’t have to spend a fortune on a workstation. Worry about your data. If you spend more time worry about your software than letting your data work for you you are doing it wrong.

Tomado de Starting a GIS

Sobre Python y los SIG

Lo dijo James Fee:

You wouldn’t jump from space without a parachute and you sure as hell don’t want to “do GIS” without Python.

Y para Rematar:

Look, either embrace change or be replaced. The idea that you’ll sit at some desk, string together ArcGIS Toolbox wizards doesn’t end well. This only results in you getting paid minimum wage with no where to go. The reality of the world we are in is the only thing you have to separate yourself from the 7 billion other people in the world is your flexibility and skills. If you don’t stand out, you’ll be nothing but a chair moistener in sector 7g.

En conclusión, si trabajas en SIG con ArcGIS y no sabes python, probablemente estás desperdiciando una gran oportunidad.  (O en otras palabras, los wizards son muy prácticos pero bastante limitados para “tareas reales” de un analista SIG.


Arcgis 10 y Python: Automatizar Compress y Analyze

Una de las tareas que todo administrador de bases de datos geográficas ArcGis/SDE debería realizar con frecuencia (e incluso a diario), es la ejecución el proceso de compresión (Compress). Dicho proceso permite optimizar el almacenamiento de los registros en el motor de bases de datos relacional.

Con el siguiente script de python utilizando el paquete de programación de arcgis conocido como arcpy se puede además de realizar el compress (Compress_management) , permite ejecutar el análisis de datos para un esquema de base de datos específico .
(Según la documentación oficial El proceso de Analyze_management consiste en: “Actualiza las estadísticas de la base de datos de las tablas de negocios, las tablas de entidades y las tablas delta junto con las estadísticas de los índices de esas tablas.” )

Ver script en github: