import numpy as np a = np.array([1,0,0])Â Â b = np.array([0,1,0])Â Â print np.cross(a,b)
# LeftRight.py # Vector Cross Product # to find which side a point is of a polyline # Kim Ollivier 18 Feb 2012 import numpy as np # Get the points from original point, Near and shape.lastPoint # eg xPnt = (1,20) intPnt = (11,9) lastPnt = (5,20) # make two 3D vectors relative to the intersection point # for a local origin at the intersection point a = np.array([xPnt[0]-intPnt[0],xPnt[1]-intPnt[1],0])  b = np.array([lastPnt[0]-intPnt[0],lastPnt[1]-intPnt[1],0])  c = np.cross(a,b) if c[2] > 0:    print "Side is left" else:    print "Side is right" print c
I just want to compliment Richards answer. When a python script is run from within ArcGIS as a scripting tool it's possible to call arcobjects within the calculate field tool. I've used this approach sometimes when I wanted to access the fine grade geometry tools that ArcObjects has. The QueryPointAndDistance method on IPolyline is certainly a very useful bit of wizardry I use it regularly!
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.