1

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[0].value).catalogPath
ds1 = arcpy.Describe(P[1].value).catalogPath
arcpy.Erase_analysis(ds0,ds1,'eraseOutput','0 Meters')
mc = int(arcpy.GetCount_management('eraseOutput')[0])
if mc > 0:
    P[1].setErrorMessage('The flight does not completely cover the landuse!')
else:
    P[1].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[0].value).catalogPath
arcpy.MakeFeatureLayer_management(ds0,'Start_lyr')
ds1 = arcpy.Describe(P[1].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')[0])
if mc > 0:
    P[1].setErrorMessage('The flight does not completely cover the landuse!')
else:
    P[1].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?

  • Have you tried topology esp. Must cover each other, Must be covered by rule? – SIslam Apr 21 '16 at 5:22
  • I haven't thought about it. Thanks. I will try it. – Panos Apr 21 '16 at 5:27
  • Unfortunately, geodatabase Topology isn't available with a Basic license – Stephen Lead Apr 21 '16 at 5:31
  • Oops! You are right! Any other idea? – Panos Apr 21 '16 at 5:35
  • Intersect both layers. If area of result=area of flight, overlap 100 %. Gp – FelixIP Apr 21 '16 at 6:09
4

I have a layer of landuse and a layer of Flight. I want to check if the Flight covered completely the landuse.

If you want a non-geoprocessing method, then I think you're left with:

  • select by location from landuse where flight "completely contains the source feature"
  • switch the selection set on landuse
  • if any features remain selected, they were not completely contained by flight
  • To add to @Stephen Lead answer, I would recommend processing the data locally within a geodatabase and making sure the fc are spatially indexed. – artwork21 Apr 21 '16 at 12:27
  • I tried it not with completely contain but with within. I check if the landuses are within the Flight polygons. The problem is that Flight is used as each polygon and not as a totally dissolved area. – Panos Apr 22 '16 at 11:42
0

Doesn't the Data Reviewer extenstion effectively deal with this?

http://desktop.arcgis.com/en/arcmap/latest/extensions/data-reviewer/finding-duplicate-geometry.htm

  • Could you add a bit more description to your answer. Just having a one-liner and a link won't help others if they have a similar issue. How does the 'Data Reviewer extension' deal with overlapping polygons? – Knightshound Jun 10 '16 at 21:26
  • Thanks for you response, but it does do what I want and I want sth pythonic so that I can change the code above. – Panos Jun 13 '16 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.