Select to view content in your preferred language

# How to I determine if data points are located left or right of a contour line?

9963
13
11-16-2014 05:18 PM
Deactivated User

I have a two dimensional landscape with around 2000 xy points. I also have a single contour that winds its way through the landscape. I need to know how far each point is to the line, but i ultimately need the distance estimates to be polarized, so that points to the left have a negative distance, and those to the right have positive distances. A point exactly on the contour would have a distance of zero, and points further away have larger distance values.

I have been able to obtain distances from each point to the contour using the NEAR TABLE tool. Problem is they are all positive, and there are far too many points to eyeball each point to see if it is left or right of the contour. Is there a simple method for generating a list of xy points on each side of the contour, or a more efficient was of obtaining polarized measurements?

Sean

Tags (4)
13 Replies
MVP Emeritus

In order to answer that one needs to specify the direction of travel along the polyline.  Is left and right in the direction of digitizing or opposite it or are you trying to get some east vs west or North vs south statement.

Looking at the Near Tool's help topic     you should be able to exploit the location and angle option if you specified them.  For example you could compare the X coordinates of the points with the X's of the location of the nearest point.  If the line was running in the N/S direction, a value of X for the point would be negative if it were less than the X for the nearest point location  etc etc  you can come up with the rule set by examine these information in light of the point pattern and the location, shape and tortuosity of your linear feature.   PS  A picture would be nice in your next post or in the original

Esri Esteemed Contributor

"Left" and "right" are somewhat arbitrary without a frame of reference.  Assuming you mean with respect to the direction of the line segments, then basic trigonometry would give the answer [a = atan2(dy,dx)].  You just need to know when and how to change answers in radians with range [0...2pi] to answers in radians with range [-pi...+pi] (or degrees bearing from north, or whatever units will permit the comparison you want).  Make sure that your solution determines which segment was closest, and that the calculation of the orientation of that line segment uses the same units. It may be simpler to construct a left-hand rule polygon from the line with the arcs of the MBR, in which case it becomes a point-in-polygon problem (inside left, outside right).

-V

Esri Esteemed Contributor

A rather manual way could be to create a rectangle and to split it using the contourline. Assign proper codes to both polygons that result and intersect them with the points. That way they you will obtain information to which side of the contourline they are located.

In case you prefer coding the problem, there is a method in the arcpy.Polyline() object called queryPointAndDistance.

Finds the point on the polyline nearest to the in_point and the distance between those points. Also returns information about the side of the line the in_point is on as well as the distance along the line where the nearest point occurs.

Kind regards, Xander

Deactivated User

Hi Xander,

This sounds like the best solution to the problem, as the contour line is nonlinear and many points fall very close to the line meaning that inferring polarity information from the NEAR TABLE angle and position info.

Im quite new to arcmap, and have no idea how to go about creating a rectangle and splitting it by the contour line. Can you point me in the direction of a tutorial or provide some basic instructions?

thanks

Sean

p.s. a map of the problem is provided below. The red contour is the contour of interest, so ignore the other two.

Esri Esteemed Contributor

Hi Sean,

To create a rectangle feature:

To split a polygon (rectangle):

General information on editing:

Kind regards, Xander

Deactivated User

Thanks! Ill see how I go with this...

Deactivated User

Here is an image of the map. The red line is the countour of interest.

Esri Esteemed Contributor

Again, right and left are relative.  What is the directionality of the lines (start/stop).

The points north of the extent of the line have no obvious "side".

Those markers are *really* busy for trying to explain your purpose.

- V

Deactivated User

the northern points that fall above the line will be removed in the next iteration of this, so that the contour will divide the map into two discrete areas. The points will therefore fall into one of the two areas. I just need to know which of the two areas, call them left/right, A/B, -/+ or any other arbitrary distinction that works.

p.s. Sorry for the choice of points, I've *really* busy