pretty print fields

This is a piece of code i’ve written and re-written dozens of times. Typically I code it on a whim for a single use.

Today I went the extra mile and made the output really nice, so here it is in case somebody has use for it.

And this is what you get as output in the python window*.
pywin_pprint

* this is the nice and new ArcGIS Pro’s python window.

The output is a bit too wide for use in terminal (80 characters) but within the app it’s nice and clear.

Happy coding.

Getting more arcpy help

A lot of people are posting requests asking for a particular snippet in the comments section of this blog.

By all means, continue to do so, we do enjoy tackling the more generic and broadly useful requests… but we just can’t tackle all of them, and not in a timely manner.

So if you need help with code, and you need it fairly soon, please consider also opening a discussion on the Esri geonet site.

Happy coding.

Python & arcpy presentations at the 2014 user conference

Once upon a time, there was but a single tech workshop at the Esri international user conference which featured everybody’s favorite scripting language. No longer is the Python offering so paltry. Behold, the 2014 user conference technical workshops & demo theaters returned when you search for “python”.

Consult the online agenda for date and time when these are offered.

Technical workshops

  • Python: Getting started
  • Python: Beyond the Basics
  • Python: Map Automation
  • Python Map Automation: An Introduction to arcpy.mapping
  • Python Map Automation: Beyond the Basics of arcpy.mapping
  • Python: Raster Analysis
  • Python: Building Geoprocessing Tools
  • Python for Analysis
  • Analyzing Multidimensional Scientific Data in ArcGIS
  • Automating Geodatabase Creation with Geoprocessing Tools
  • Creating Geoprocessing Services
  • Customizing ArcPad with JavaScript, Python, and VBScript
  • Desktop Mapping: Building Map Books
  • ArcGIS Online: Administering your ArcGIS Organization Through Scripting
  • ArcGIS for Server Administrative Scripting and Automation
  • ArcGIS Network Analyst: Automating Workflows with Geoprocessing
  • Integrating Open-Source Statistical Packages with ArcGIS
  • Useflul Python Libraries for The GIS Professional

Demo theater presentations

  • Administering ArcGIS for Server with Python
  • Building Live Data Feeds Using Python
  • Consuming Geoprocessing and Hosted Analytic Services in ArcGIS for Desktop
  • Debugging Python Scripts
  • Esri Production Mapping: Automating Map Production Workflows Using the ArcPyProduction Site Package
  • Geoprocessing on Image Services
  • Getting Started With Map Algebra Using the Raster Calculator and Python
  • Getting Started with Python in ArcGIS
  • Interacting with the ArcGIS Server Admin API using Python
  • Managing an Online Data Warehouse: Using Python to Publish Data to ArcGIS Online
  • Python Add-ins: Tips and Tricks

python/arcpy code from the 2014 dev summit

Hey Everyone,

it was great meeting and talking to everybody at the dev summit.

A number of python/arcpy presenters already shared their code to github repos below.

Happy coding.

merge polyline paths

Somebody on the team was having trouble tracing streams due to breaks in the streams introduced when converting raster to feature.

So here is slick little solution which takes n paths in a line features and makes a 1 path (aka 1 part) out of it.
None of the vertices are moved. Where there were two paths separated by a gap you will have one path with no gap.

To work property the paths have to be pointed in the same direction and not be converging. To deal with that would require quite a bit more logic.

As is script modified data in place, so back up your data before using.