arcpy.AddField_management(indxTileSinglePartFC, "ASP_RATIO", "DOUBLE") updateRows = arcpy.da.UpdateCursor(indxTileSinglePartFC, ["SHAPE@","ASP_RATIO"]) for updateRow in updateRows: shapeObj = updateRow[0] x1,y1,x2,y2,x3,y3,x4,y4 = [float(coord) for coord in shapeObj.hullRectangle.split(" ")] distance1 = math.sqrt((x1 - x2)**2 + (y1 - y2)**2) distance2 = math.sqrt((x2 - x3)**2 + (y2 - y3)**2) if distance1 <= distance2: updateRow[1] = distance2 / distance1 else: updateRow[1] = distance1 / distance2 updateRows.updateRow(updateRow) del updateRow, updateRows
distance1 = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
distance1 = math.hypot((x1 - x2), (y1 - y2))
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.