Dan_Patterson

Derive featureclass properties quickly... more than geometry

Blog Post created by Dan_Patterson Champion on Jun 17, 2019

Featureclass Properties

 

  • Feature class info
  • Field info
  • Geometry info
  • Geometry decomposition

 

The code... I will update here.

 

 

Information functions for featureclasses

A quick solution to obtain geometry information.  Other info can be added.

fc_info(in_fc, prn=True)

FeatureClass:
   C:/Arc_projects/CoordGeom/CoordGeom.gdb/Shape2
shapeFieldName  OIDFieldName  shapeType spatialReference
Shape           OBJECTID      Polygon   NAD_1983_CSRS_MTM_9

Those pesky fields.  Don't want to open up ArcGIS Pro to find out?  Already got Spyder (or your Python IDE) open? Use this.

fld_info(in_fc, prn=True)

FeatureClass:
   C:/Arc_projects/CoordGeom/CoordGeom.gdb/Shape2
Name          Type         Length Nullable  Required 
OBJECTID      OID               4 False     True     
Shape         Geometry          0 True      True     
Shape_Length  Double            8 True      True     
Shape_Area    Double            8 True      True     
CENTROID_X    Double            8 True      False    
CENTROID_Y    Double            8 True      False    
INSIDE_X      Double            8 True      False    
INSIDE_Y      Double            8 True      False    

How many shapes? Are they all singlepart? How many points?  Which points connect to make what shape?

fc_geom_info(in_fc, SR=None, prn=True, start=0, num=10)

Featureclass:
    C:/Arc_projects/CoordGeom/CoordGeom.gdb/Shape2
   Shape    Parts   Points From_pnt   To_pnt
       1        2       21        0       21
       2        2       18       21       39
       3        1        4       39       43

Same as above... but where do the parts stop and start? Everyone loves stats! Right?

fc_composition(in_fc, SR=None, prn=True, start=0, end=50)

C:/Arc_projects/CoordGeom/CoordGeom.gdb/Shape2
Shapes :   3
Parts  :   5
  max  :   2
Points :   43
  min  :   4
  median : 9
  max  :   11
     IDs     Part   Points From_pnt   To_pnt
       1        0       11        0       11
       1        1       10       11       21
       2        0        9       21       30
       2        1        9       30       39
       3        0        4       39       43

 

So simple, so...  _common give it a try

More offerings in … npGeo ... numpy geometry 

 

Oh yes... Nice documentation too...

 

Outcomes