I will try to be as detailed as I can.
I have created a Script tool. In this tool, I have two parameters: a) the Landuse and b) the Flight.
In the ToolValidator, I used the following code to check if the Landuse is completely covered by the Flight.
P = self.params ds0 = arcpy.Describe(P.value).catalogPath ds1 = arcpy.Describe(P.value).catalogPath arcpy.Erase_analysis(ds0,ds1,'eraseOutput','0 Meters') mc = int(arcpy.GetCount_management('eraseOutput')) if mc > 0: P.setErrorMessage('The flight does not completely cover the landuse!') else: P.clearMessage() arcpy.Delete_management('eraseOutput') del ds1 del ds0
and it works good.
On second thought, I wanted to make my tool to be used by users with Basic license, so I changed the code as follows:
P = self.params ds0 = arcpy.Describe(P.value).catalogPath arcpy.MakeFeatureLayer_management(ds0,'Start_lyr') ds1 = arcpy.Describe(P.value).catalogPath arcpy.Dissolve_management(ds1,'Flight_diss1',,'','MULTI_PART','DISSOLVE_LINES') arcpy.SelectLayerByLocation_management('Start_lyr','within','Flight_diss1','0 Meters','NEW_SELECTION','INVERT') mc = int(arcpy.GetCount_management('Start_lyr')) if mc > 0: P.setErrorMessage('The flight does not completely cover the landuse!') else: P.clearMessage() del ds1 arcpy.Delete_management('Flight_diss1') arcpy.Delete_management('Start_lyr') del ds0
and it works fine, as expected with the same results.
Due to the fact that it's not the better way to use Toolvalidator with GP processes like Erase, Dissolve, Union, etc and the data that are about to be used in the tool are relatively big (100.000 landuse polygons and 1.000 Flight polygons), I was wondering if there is a better (faster) way to have the same results as the above code without using GP processes or if there can be an optimization of it?