Arcpy shapes... viewing in Spyder

11-18-2019 05:00 AM
Labels (1)
MVP Esteemed Contributor
2 0 555


It is nice that you can view geometry in ArcGIS Pro.

Ditto for notebooks in your browser.

But I really hate cranking up a new featureclass when I am working on a geometry exploration, when all I want to see is what the numbers actually look like.

I stumbled on this when I was working on my npgeom package, which uses an alternate geometry constructor than is used in the arc* line of products.  It also deconstructs geometry using arcpy data access cursors and/or  FeatureClassToNumPyArray.   (Thas is another story though)

In short, I was doing my thing and got 3 polygons objects from a featureclass.

Lines 78-80... blah blah, stuff comes out

Line 81 ... wanted to make sure they were polygon objects.... indeedy they were

Line 82, 83, 84 (right side of graphic)

   cool!  perfect polygons

       [82] A multipart polygon with 2 holes in the first part and 1 in the second

       [83] Another multipart, 3 holes in one, none in the other

       [84] The triangle, paying homage to a simpler time when geometry deconstruction was easier

I won't go into details, but my python setup is noted at the bottom of the callout in the graphic.

More details when I explore more.  Going to replicate this as a *.ipynb for use in the browser AND with Spyder as well.

Hopefully other python IDEs support these as well.  Some use qt and mpl in their graphics display arsenal.


I did forget to mention that you can save the contents of the qt console in spyder to a couple of formats for posterity.

I save a little sample in the attached zip file.. 

  • unzip it to a location (eg. c:\temp
  • double-click on the npg_01.html file and it should load in your browser

Of course you can edit the html file to fix any stuff that you want.

You can save to svg format as well (see attached)

You people had better get back to work

About the Author
Retired Geomatics Instructor at Carleton University. I am a forum MVP and Moderator. Current interests focus on python-based integration in GIS. See... Py... blog, my GeoNet blog...