import arcpy square = [[0,0],[0,1],[1,1],[1,0]] small_square = [[0.1, 0.1],[0.1, 0.9], [0.9,0.9], [0.9,0.1]] pnt = arcpy.Point() array = arcpy.Array() for a_pnt in square: pnt.X = a_pnt[0]; pnt.Y = a_pnt[1] array.add(pnt) poly1 = arcpy.Polygon(array) array.removeAll() for a_pnt in small_square: pnt.X = a_pnt[0]; pnt.Y = a_pnt[1] array.add(pnt) poly2 = arcpy.Polygon(array) array.removeAll() print "poly 1 contains poly2 :", poly1.contains(poly2) print "poly 2 contains poly1 :", poly2.contains(poly1)
Happy New Year everyone!!I need your help on this after googling for days.I am using ArcGIS 9.3 and want to develop a Python code (Python version = 2.6) to recognize if a polygon is inside another polygon. These polygons are created by codes and not in any shapefiles or feature class. Therefore, I don't want to create a new shapefile to just use Select By Location.I wish there is something like: aPolygon.contains(aPolygon) = True/FalseI tried shapely.geometry but ArcToolbox doesn't recognize this line: "from shapely.geometry import Polygon". Shapely can do the topological relationship very simple.Any helps is appreciated.
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.