social-science-data-editors / guidance

Guidance by Data Editors
https://social-science-data-editors.github.io/guidance/
Other
13 stars 11 forks source link

Provide guidance on GIS reproducible best practice #19

Open larsvilhuber opened 4 years ago

larsvilhuber commented 4 years ago

GIS code often is a challenge. Need some pointers to guidance to not have to do it by hand.

larsvilhuber commented 4 years ago

Info from Matthew Turner (Brown):

There are three main ways to automate ARCGis Processing.

  1. Use the ARCGIS model builder feature' to record the series of commands that you use for GIS processing. This will allow you to save amacro' that you can execute within ARCGIS. It is possible to save the `model' and load it into an ARCGIS session on another machine. In a purely formal sense, this automates your processing and allows it to be replicated on another machine. As a practical matter, the model files tend not to be portable because they hard code machine specific information about, e.g., file locations. If your data is on disk E, any one else trying to run the model will need to have their data on disk E as well.

  2. (Better) Given a model, ARCGIS will convert the model into a series of python commands. These python command can be executed by the python installation that is native to ARCGIS (don't bother trying to use a different python installation). This allows you execute the file as you would any other python program, subject to the fact that you are constrained to call the the ARCGIS python installation. This is better in that it is easier to figure out where all of your files are supposed to be -- it will be encoded in the python program.

  3. (Best) If you know a little python and understand GIS, you can just do your GIS processing in python, and execute GIS commands by calling the relevant command in the ARCPY library. ESRI has extensive online documentation and lots of sample programs online. For example, try searching for `arcpy buffer' to see what is available about how to create buffer polygons around a shapefile. This is not too much different from (2) above, except that you are no longer dependent on ARC for the exact syntax of your python code (ARC tends to generate baroque code) and you can write portable python code.