0
I am developing an app for android that uses the google maps API, everything is right with the app the problem is in the webservice that deals with the information collected by the app, at a certain time I create a Polyline in the app and send the coordinates to the WS, I need to check in the WS what distance of any point of the line I created for example, suppose my line starts at the point -25.428781,-49.263291
and end at the point -25.431941,-49.261888
, I need to know the distance from the point -25.431069,-49.263251
from my LINE, not the distance from the third point to the first and from the third point to the second, I need to know the distance from the LINE. On Android has a library that does this to Google’s own android-maps-utils, but I could not use it in my WS because it is a package .aar
and I am using Maven, I accept suggestions for solutions directly to the problem as well as solutions to add this .aar
in my project because both would solve the problem. To simplify I leave here the image of the map:
I need to know the distance of the GREEN line between the reference point and the route.
This is a matter of geometry. See Point-Line Distance-2-Dimensional and use equation 14.
– ramaral
Yes, I was already researching how to calculate point distance from the line :) the only problem is using latitudes and longitudes for the calculation, but as this feature is available on android I thought I have something similar available for a java application.
– Victor Hartur de Carvalho
About the editing of tags I do not agree that this doubt is related to android because as I said, in the application is working normally, the problem is in WS that is java(spring boot). I don’t know how to communicate this disagreement so I posted as a comment.
– Victor Hartur de Carvalho
I edited now. In situations that do not agree with the edition you can reverse the editing or edit the question and put the tags you want.
– ramaral
At first I thought that the answer in the ramaral would not help me, but I tested and worked perfectly. I had a little work to convert the result to meters by using latitudes and longitudes as a reference, but gave certinho, thanks.
– Victor Hartur de Carvalho
Put an answer with your solution.
– ramaral