1

I am quite new to Python and I am attempting to practice by making a simple program with ArcGIS. I wanted to make a script that automated the calculation of population density of selected census tracts within the city of Plano, TX. I also wanted to give the ability for the user to choose the census tract.

I then wanted to provide a map layout in ArcMap of the specific tract with the population, area, and population density being shown.

I realize most of this can be done using ModelBuilder, but I needed practice with Python and thought this would be a good simple program to start with. Anyone have any pointers on the script and also how I could possibly make it better?

  • Well one thing to remember is, you can always use model builder to put together certain chunks of the process and/or just to create an example workflow and then export to python and copy and paste or just examine for reference that way. No, model builder won't export complex looping, arcpy cursors, etc. But you could put together some of the components and just copy and paste them into the for loop or such as that. Just a thought if you reach a snag you can't figure out a tool's syntax for. – John Dec 3 '13 at 22:02
2

Are you trying to create a python toolbox? This seems like a very easy script to write, using the select by attribute tool and making this tool model your tract parameters in numbers. I am sure there are a number of resources online for this type of toolbox. It is a very logical process within modelbuilder and ArcGIS' geoprocessing tools, as it is within Python.

You will probably have to use the arcpy.mapping module for your map layout.

  • Thanks for the help Geoffrey..never tried to create a Toolbox on Python before. Is there a certain resource somewhere online which could show me some example code for creating one? – Victor Dec 4 '13 at 0:55
  • I was just gonna write each geoprocessing function individually. – Victor Dec 4 '13 at 0:57

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.