Bug report on arcpy.Describe

4304
11
06-09-2015 08:34 AM
TomGeo
by
Occasional Contributor III

Since ESRI put the customer number and phone number as protection from customers in I cannot find any other way...

Using ArcGIS in version 10.3 and retrieving the count for selected features in a feature class utilizing

arcpy.Describe('my_feature_class').fidset.split(';')

, the minimum number delivered back is 1.

To illustrate the problem a bit...

2.pngFigure 1: Two polygon feature classes, where the circle is a buffer created around a point. The question at hand is, if there is any polygon from the other feature class intersecting with the buffer. As visible in the image, there is no intersecting feature.

3.pngFigure 2: The attempt to find intersecting features, using the SelectLayerByLocation function. No feature is selected, but when requesting the number of objects through the Describe function, the length of the list is one and not zero! The length of the list is not correct since the Describe function delivers an empty string back in case there is no intersecting feature.

1.pngFigure 3: Another buffer, this time intersecting with the other polygon layer. Clearly, the two polygon layer have intersecting features.

4.pngFigure 4: Again, the SelectLayerByLocation function used to select intersecting features, and the Describe function utilized to retrieve the number of intersecting features. While the length of the list is the same, the list item itself is holding this time the correct FID of the intersecting feature.

5.png

Not really nice, when you want to exclude buffers that do not have any intersecting features in another feature class, and/or want to work with buffers that have only a single object intersecting.

Finally: The system to submit bug reports is flawed. Why does not have any user the possibility to submit bug reports, no matter if you have a customer number at hand or not? My technical support is not available, due to working hours, and I will not invest the time to find out the customer number and the phone number connected to the account to contact ESRI via a 'Support Request Form'.

Just my fifty cents,

Thomas

- We are living in the 21st century.
GIS moved on and nobody needs a format consisting out of at least three files! No, nobody needs shapefiles, not even for the sake of an exchange format. Folks, use GeoPackage to exchange data with other GIS!
Tags (2)
0 Kudos
11 Replies
KimOllivier
Occasional Contributor III

I would not use Describe in this way to find the number of features on an intersect selection any more.

This is a desperate workaround using old technology that is very clumsy and slow compared to using geometry objects. I know we all used to use FIDSETs in scripts because there was no other way, but now there are much better ways.

Never use buffer. It is a redundant step that was only put in training courses to illustrate a spatial extent. In real life things are not well modelled by a buffer, floods follow contours, not a buffered centrelines, pollution creates a plume, not a circular area around a pollution point source. You can always use a selection radius around a point without having to waste computing power creating a separate featureclass. Even if you do need a polygon to say cut up another polygon into parts you can create a polygon geometry from a point, instead of a polygon featureclass.

Use geometry objects. These are relatively new at 10.x and save a huge amount of processing to temporary disk based featureclasses. It is easy to turn featureclasses into lists of geometry objects that can be used instead of a featureclass with spatial operators. Geometry objects also have spatial operators so you can compare pairs directly. The help has some excellent diagrams for the spatial operators. The operators are extensive and cover every case of possible overlaps. Instead of looking for a count after a timewasting SelectByLocation() you can just ask if geom1.crosses(geom2):  It is fast because it is all in memory and is much easier to program. No need to run Describe() at all.

SusanJones
Occasional Contributor II

Nice response and in a nutshell.

Respect Kim Ollivier - He's got year of Geoprocessing on all of us. Really knows his stuff

Suasn

0 Kudos