Part 5 ... The attributes attached to the geometry
---- As before, the inputs ----
The polygons that I will be using are shown to the right.
- A square, 5 points, first and last duplicates
- A lake on an island in a lake...
- A multipart with a two different shaped donut holes
- The letter 'C'
- The letter 'V'
Each part is labelled at the labelpoint rather than the centroid, hence each part gets labelled.
|---- An Alternate Geometry Reconstructor ----|
|---- Arrays to Poly* Features ----|
Never use <null> in a table. To many posts on the forum on how to trap them, find them, replace them.
Always put in a value to represent all conditions. Too many people use None <null> as the catchall category. In reality all observations need to be classified exactly, there really is no such thing as <null>. You either made and observation or you didn't. If you didn't, your classification scheme should provide a key indicating that.
If an observation was made but the phenomenon/parameter/whatever was actually not there, there should be a key for that. Similar, for 'I forgot', 'Wasn't my job' or whatever other excuses exist.
Making none/null/real nothingness
You can add to, or remove from, the list below. These are some that I use. I will draw your attention to the NumPy incarnations for integers. Equivalent values exist for floats. Any value that ensures that you will take a second look if a calculation looks weird is good. However if your table contains <nulls> even after my lecture above, this will help mitigate your... stupidity is such a harsh word... but you get my drift
My favorite way of getting just the attributes
Such nice functions, FeatureClassToNumPyArray, TableToNumPyArray, and back the other way.
I am sure many of you have explored where it all comes from only to find it all buried in a *.pyd file
No bother, since you can pull out data for the attributes nicely accounting for <null> records.
The explorers amongst us, may have discovered a few searchcursor shortcuts
Sadly, the integer fields with <nulls> bring the whole shortcut down.
The searchcursor actually has enough information in it to create a structured/recarray.
If you have a clean table with no nulls, the actual calls to _dtype and fields show that you can clearly link cursors and NumPy arrays. Too bad, the whole integer fix isn't incorporated, but _as_narray and FeatureClassToNumPyArray and TableToNumPyArray yield the same results on a 'clean' dataset.
- Work with the geometry... and/or … work with the attributes, then put it all back together.