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 aPolygonrows = arcpy.SearchCursor(inMaskShp) #inMaskShp is the input mask shapefile attachedrow = rows.next()inMask = row.getValue("Shape") #inMask is the first polygon of the inMaskShpapoly = createPolygonCell(30, 565845, 3881985)apoly.within(inMask) #this returns FALSE although it should be TRUE
I don't think it is out yet...so use the workaround in the interim
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-classthere is a NIM number which you can track the error onNIM059845which indicates that it is resolved as of version 10 SP2 and in 10.2http://resources.arcgis.com/content/nimbus-bug?bugID=TklNMDU5ODQ1
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.