POST
|
OK. Thanks Dan. I don't think it is out yet...so use the workaround in the interim
... View more
03-17-2011
11:39 AM
|
0
|
0
|
183
|
POST
|
Thanks Dan. Could you please let me know where I can download SP2? I just can't find it myself. Thanks. without examining the details of your situation in detail, you should be aware that problems have been discovered when using arcpy's geometry objects when no spatial reference is specified. a protracted discussion is noted in: http://forums.arcgis.com/threads/9763-Errors-in-arcpy-s-Polygon-class there is a NIM number which you can track the error on NIM059845 which indicates that it is resolved as of version 10 SP2 and in 10.2 http://resources.arcgis.com/content/nimbus-bug?bugID=TklNMDU5ODQ1
... View more
03-17-2011
11:04 AM
|
0
|
0
|
183
|
POST
|
Hello everyone, I am trying to check if a polygon is within a mask, which is another polygon. To do this, I use the method CONTAINS. However, this method seems to be wrong because it returns FALSE but in fact it should be TRUE. I am attaching here the mask shapefile and below is the code. def createPolygonCell(intCellsize, leftX, upperY): aPoint1 = arcpy.Point() aPoint2 = arcpy.Point() aPoint3 = arcpy.Point() aPoint4 = arcpy.Point() aPoint1.X = leftX aPoint1.Y = upperY aPoint2.X = leftX + intCellsize aPoint2.Y = upperY aPoint3.X = leftX + intCellsize aPoint3.Y = upperY - intCellsize aPoint4.X = leftX aPoint4.Y = upperY - intCellsize array= arcpy.Array() array.add(aPoint1) array.add(aPoint2) array.add(aPoint3) array.add(aPoint4) array.add(aPoint1) aPolygon = arcpy.Polygon(array) array.removeAll() return aPolygon rows = arcpy.SearchCursor(inMaskShp) #inMaskShp is the input mask shapefile attached row = rows.next() inMask = row.getValue("Shape") #inMask is the first polygon of the inMaskShp apoly = createPolygonCell(30, 565845, 3881985) apoly.within(inMask) #this returns FALSE although it should be TRUE I do export inMask and apoly to shapefiles to double check whether apoly is within inMask. Also, the method CONTAINS returns FALSE as well. And it is not correct. In addition, interestingly, the four corners of the apoly (which is a little square) are within inMask when I use apoint.within(inMask). Could anyone please shed a light on this (i.e. how to check a poly within another poly)? Thanks.
... View more
03-16-2011
07:56 PM
|
0
|
4
|
423
|
POST
|
Thanks. This is really a big help. I have wasted a lot of time on this.
... View more
03-16-2011
12:36 PM
|
0
|
0
|
403
|
POST
|
Thanks Vara and Dan. Actually, I can do with VBA but just want to do this in Python because I have some other functions in Python as well. This command "From shapely.geometry import Polygon" was understood in Python Shell. However, when I created a script and ran it through ArcToolbox, the geoprocessing message window kept saying -------------------- <type 'exceptions Import.Error'>: "No module named shapely.geometry Fail to execute (test)." -------------------- Any thoughts? Thanks.
... View more
01-02-2011
06:18 AM
|
0
|
0
|
2362
|
POST
|
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/False I 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.
... View more
01-01-2011
08:20 PM
|
0
|
5
|
6035
|
Online Status |
Offline
|
Date Last Visited |
10-27-2022
11:04 PM
|