Hello everyone,
I need to create a python script that finds all the liens that were digitized outside a grid polygon layer.
What geoprocessing tools do you recommend in Model Builder or Python to perform this analysis?
Thanks
https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/select-layer-by-location.htm
You could use either the tabulate intersection tool, which will tabulate every instance of the coinciding lines that are within a grid polygon layer.
If using python:
That would help you identify the ones that are outside of the grid.
If using ModelBuilder:
No code or model is required for this, simply use the select by location tool, have the selection type set to intersect and ensure invert selection is ticked on
Does the Select By Location identify the lines that start inside a grid (polygon) and finish in a area without any grid (polygon).
What about this solution: Use the erase tool to delete all lines inside the grid area (polygon). The remaining lines are the ones that are outside the grid.
This is a different question you are asking and strongly demonstrates why you should always include images in your question so it very clear what you are asking (may be you should go back and edit your question and include an image?). Your original questions asks:
finds all the lines that were digitized outside a grid polygon layer
Well my simple solution finds all the lines outside the polygons.
You now seem to be asking to:
find all portions of lines outside the polygons.
This includes whole polylines and parts of a polyline that originated from within the polygons but are outside the polygon.
The erase tool would certainly achieve this, deleting the portions of lines within the polygons but be aware that this is an advance level licensed tool and if you plan to distribute your tool you need to state this in any documentation to stop people with the incorrect license using it.