## NumPy and Geometry

A numpy geometry class and functions that work with arcpy and ESRI featureclasses is provided here to facilitate working with vector geometry using the ndarray as its base.

This is a work in progress, so bear with me. The intent of the Geo class is to treat the geometry of featureclasses as one entity. See npGeo.py in subsequent sections for details. Converting esri's arcpy geometry objects to array representations is contained in npg_io.py. Most approaches I have see so far tend to construct the geometric representations of geometries using some variant of arcpy cursors.

When trying to work with numpy and the geometries, this creates problems since geometry is rarely a collection of simple shapes (eg. rectangles, circles, triangles). Object arrays containing the coordinates are the norm. An object array is created when the number of points per feature and/or feature part are not uniform. For example, a square with a triangular hole in it, will have an outer ring, oriented clockwise consisting of a list of 5 points with the first and last point being the same. The triangular hole will be represented by 4 points oriented counterclockwise. Now that arrangement of points can be used to represent a polygon, a closed-loop polyline or a multipoint. The same points can be used to represent 3 distinctly different geometric objects.

What I set out to do was create a uniform 2D array of coordinates and a companion array which denotes the feature ID and the from-to point pairs. This is similar to the FeatureClassToNumPy array approach, but that particular function and its inverse, are only useful for simple singlepart geometries.

I will document and build on these tools set with examples.
Generally, I am only working with featureclasses stored in a file geodatabase. There are tools to derive geometries from geojson format or other formats capable of generating array-like structures.