Calculate if a geographical point is included in a rectangular area defined from one of it bisection

35 Views Asked by At

With a path of geographical point defined as follow: lat,lng|lat,lng|lat,lng|etc, I'd like to determine from which segment of the path a geographical location is nearby.

To do so, I'd like to define an area of proximity defined this way:

A-------B-------C-------D-------E
|       |       |       |       |
|       |       | Here  |       |
|       |       |       |       |
V-------W-------X-------Y-------Z
|       |       |       |       |
|       |       |       |       |
|       |       |       |       |
F-------G-------H-------I-------J

where:

  • each segment of the path is defined this way: [V(lat,lng),W(lat,lng)]
  • and for each segment, a rectangular area is defined such as the path is one bisection of the rectangle, and the perpendicular sides of that bisection have an arbitrarily defined length (e.g.: 100m on each side of the path).

How to calculate the geographical coordinates of A,B,C,D, etc, and then calculate if a location is included in the areas defined by these coordinates ?