# QueryPointAndDistance

677
5
09-19-2017 03:01 AM
New Contributor

hi

i have a piece of code that uses the method

# QueryPointAndDistance .

the method accepts a line and a point and is supposed to return  a point that is closest to the given point on the line.

it also returns a few more details.

one of them is bRightSide .

esri defines it as :

"bRightSide is an output parameter that tells if the output point is on the right side of the curve. "

what does on the right side mean ?

close to the from point ?

close to the to point?

what is defined as close ?

help will be appreciated

Avi Saroussi

1 Solution

Accepted Solutions
MVP Frequent Contributor

Xander Bakker‌ is correct, the first parameter on the method QueryPointAndDistance is extension, for you to get the red point location you must have set it to esriExtendTangentAtTo. In your screen shot the nearest point would be the node of the network junction. To get that point you want extension to be esriNoExtension.

bRightSide parameter is telling you which side of the line your input point is. Assuming your network is a river network I would expect it to be returning TRUE for your green point as it is on the right bank side.

5 Replies
Esri Esteemed Contributor

Basically, the direction of the line (start to end) defines if a point is on the left or right side of the line:

New Contributor

I still don’t get it

The output point is supposed to be on the line.

New Contributor

i run the function on the selected line and the green point(see drawing) .

the result point is the red one. and the bisright return false.

1.according to the help the result should be on the line and if so what does left or right mean in that case.

2. why when i run the code on the above geometries the result  isnt on the line .

am i missing something?

thanks.

Esri Esteemed Contributor

I remember that in ArcObjects you can actually enable the extension of the line, which will simulate the line and will use the nearest point to project the point onto. It looks a bit weird, but I think it should be possible to switch that option off. In Python it would project the point to the nearest point on the line.

MVP Frequent Contributor

Xander Bakker‌ is correct, the first parameter on the method QueryPointAndDistance is extension, for you to get the red point location you must have set it to esriExtendTangentAtTo. In your screen shot the nearest point would be the node of the network junction. To get that point you want extension to be esriNoExtension.

bRightSide parameter is telling you which side of the line your input point is. Assuming your network is a river network I would expect it to be returning TRUE for your green point as it is on the right bank side.