Timeline for Distance of a Lat long from a Polyline
Current License: CC BY-SA 4.0
23 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jun 27, 2018 at 10:09 | vote | accept | Chinmay | ||
Jun 26, 2018 at 9:22 | comment | added | kogexo | @Chinmay Can you please write your question as fixed if it is? | |
Jun 22, 2018 at 9:24 | comment | added | kogexo | @Chinmay ? So ? | |
Jun 1, 2018 at 7:29 | comment | added | Chinmay | It worked for the sample data i provided you, but fails for other sample test data. So still on it. Will update more as soon as i reach a solution. Will also share other sample data too soon where its failing. | |
Jun 1, 2018 at 7:18 | comment | added | kogexo | @Chinmay Any news? So, does it work? | |
May 30, 2018 at 13:52 | comment | added | kogexo |
distance4 is just the distance between points 1 and 4: distance4 = math.sqrt(X4*X4+Y4*Y4) .
|
|
May 30, 2018 at 8:55 | comment | added | Chinmay | I have updated the script and Outputs from it again. I create another function to compute distance for finding distance4, and then use that distance. Please check and see if that's what you were calculating distance4 and lat long projection of X4,Y4. | |
May 30, 2018 at 8:24 | comment | added | Chinmay |
How you calculated distance4 , is it distance4 = compute_distance(X3p, Y3p, X4, Y4) And then convert X4,Y4 to Lat Long?
|
|
May 30, 2018 at 7:47 | comment | added | kogexo | @Chinmay I added a last projection function. That should do it. Take care, I fixed the compute_bearing function as it was using degree angles and not radians. | |
May 30, 2018 at 7:42 | history | edited | kogexo | CC BY-SA 4.0 |
Adds new result
|
May 30, 2018 at 7:08 | comment | added | kogexo | But then, why does your edit show values for X4 and Y4 (X4,Y4: -1.8006520183758197,-0.7825248257739862)? | |
May 29, 2018 at 17:43 | comment | added | Chinmay |
I have updated it with Python script, X4,Y4 values never gets through the condition if X4 < X2 and X4 > X1 and Y4 < Y2 and Y4 > Y1: and get_prep always returns None. The values are also there.
|
|
May 29, 2018 at 15:10 | comment | added | kogexo | No idea. What does it give you? Is the distance computed wrong? Is the bearing computed wrong? What are the outputs? | |
May 29, 2018 at 13:43 | comment | added | Chinmay | I have updated code in the post. Please check and let me know which step is wrong. | |
May 29, 2018 at 13:34 | history | edited | kogexo | CC BY-SA 4.0 |
added 196 characters in body
|
May 29, 2018 at 13:34 | comment | added | kogexo | What do you mean, "doesn't seem to be working"? You have all the code I had. Of course, you have to convert the meters back to latitude and longitude if you want to display them on a map. | |
May 29, 2018 at 13:09 | comment | added | Chinmay | I tried the above mentioned approach but seems to me that i am doing something wrong. I calculated the distance and bearing for X1Y1,X2Y2 pair and X1Y1,X3Y3 Pair. And then updated my X2Y2 and X3Y3 and passed it to same old function but X1Y1 is (0,0). But his doesn't seems to be working. Can you tell me what wrong i am doing or if you could share some pseudo code in fiddle. | |
May 29, 2018 at 10:26 | comment | added | kogexo |
Because of the bearing definition (counted positive when counter clockwise) for the -1 . See movable-type.co.uk/scripts/latlong.html#ellipsoid for accuracy and compatibility. It should work in all cases but your precision might not be enough everytime.
|
|
May 29, 2018 at 10:21 | comment | added | Chinmay |
Why multiplying it by -1 for Y coordinates Y2p = distance * -1.0 * math.sin(bearing) . Will it work in all scenarios of Lat Longs or is it just to make this test case to work?
|
|
May 29, 2018 at 8:33 | comment | added | kogexo | @Chinmay I updated my answer with a proposition. The function to use is Haversine formula. | |
May 29, 2018 at 8:30 | history | edited | kogexo | CC BY-SA 4.0 |
Changes picture.
|
May 28, 2018 at 19:52 | comment | added | Chinmay | Yes. I read at lot many places that you might need to convert the lat longs in cartesian coordinates earth centric, but didn't got a concrete article which mentions about how to do conversions. I understand it need to be done through vectors and cross product but not sure what should be the steps for it. | |
May 28, 2018 at 16:08 | history | answered | kogexo | CC BY-SA 4.0 |