I'm new to arcgis and arcpy, so some of my lingo and terminology may be off. I have a script that takes a feature layer as an ainput. From there I want to be able to count the number of selections in the feature layer. I also want to determine what type of layer it is, i.e. polygon, polyline, point, etc. Again, my terminology may be off. Can anyone help me with this??
|
To determine the feature type, you use describe to create a describe object of the feature layer and then use the shapeType property of the describe object. http://resources.arcgis.com/en/help/main/10.1/index.html#/FeatureClass_properties/018v00000011000000/ This is a modified example from that page:
If you only have the feature layer, then you need to use the featureClass object of the feature layer. Another modified example, based on http://resources.arcgis.com/en/help/main/10.1/index.html#/Layer_properties/018v00000063000000/
To get a count of selected records, you just use the Get Count (Data Management) tool. You have to use the result object though to get the value. http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//0017000000n7000000
Get Count will return the number of selected features if there is a selection. If there is not a selection, it will return the count of all of the features in the layer. |
|||||
|
