Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

how to skip creating an empty feature class using featureclass to featureclass in arcpy

$
0
0

I have a script that finds points outside of selected areas and creates a feature class in a file geodatabase. However, sometimes there are no points outside of the selected area. Currently, the script will create an empty feature class. I would like the script not to create the feature class if there are no points and then continue back to the top of the loop.
Below is the last part of the script.

I’m using ArcGIS 10.2 Desktop.

                #Below is the process to select from previous service area and civic address selections to find Outliers

                # Process: Select Layer By Location
            SubCivic_SubPD = arcpy.SelectLayerByLocation_management(CivicPoint_lay, "INTERSECT", SAoutputPolygons, "", "NEW_SELECTION")
            print "loc 1 success"
                # Process: Select Layer by Attribute
            Switch_SCivicPD = arcpy.SelectLayerByAttribute_management(SubCivic_SubPD,"SWITCH_SELECTION")
            print "Switch success"
            SwitchCivicPD_fld = ['OBJECTID']
            Outlier_test = "outlier"+PD_NOrow+"_"+PDPNTIDrow
            whereNotEmpty = "OBJECTID"' > ' '0'
            print "SC success"
            # Process: Make Feature Layer
            OutlierMakLay = arcpy.MakeFeatureLayer_management(Switch_SCivicPD, Switch_SCivicPD_lay)
            print "Outlier Make layer success"
            arcpy.FeatureClassToFeatureClass_conversion(OutlierMakLay, SA, Outlier_test, whereNotEmpty)
            print("Outlier Script completed successfully")

Viewing all articles
Browse latest Browse all 767

Latest Images

Trending Articles



Latest Images