Find nearest geographic coordinates

Frank Muller frank.muller.erl@REDACTED
Thu Nov 26 15:13:09 CET 2020


Thanks Mike. Very informative.
I don’t expect an exact answer (2). Even the Euclidean distance will do in
my case.

/Frank

Wed 26 nov. 2020 - 06:14, FRENCH Mike <mike.french@REDACTED> wrote :

> 1. What is the overall extent of the points?
>
>
>
> 2. Do you need the exact answer?
>    e.g. will there be many points close together and you *have* to get
> the correct one;
>             can you assume a spherical Earth, not model the exact geoid
> shape (WGS84,etc.)
>
>
>
> 3. Does the region include the areas around the poles or crossing the 180
> longitude ‘dateline’?
>
> If (1) is ‘small’ or ‘a few 100 km’, and (2) and (3) are NO, then there
> are some simple methods …
>
>
>
> If it is a localized region near the equator (e.g. within Singapore) you
> can use the Euclidean formula directly.
>
>
>
> If it is a localized region, you can assume the ‘2D tangent plane
> projection’ Euclidean approximation.
> Take the middle value for the latitude, *avlat*,  and use *cos(avlat)* to
> scale the longitudinal differences,
> then use the Euclidean formula.
>
>
>
> Regards,
>
> Mike
>
>
>
>
>
> *From:* erlang-questions [mailto:erlang-questions-bounces@REDACTED] *On
> Behalf Of *Ivan Uemlianin
> *Sent:* Thursday, November 26, 2020 6:14 AM
> *To:* Frank Muller; Erlang-Questions Questions
> *Subject:* Re: Find nearest geographic coordinates
>
>
>
> Ooh interesting.  Well there's your answer, although if you're always
> using it for `distance(A, X) < distance(B, X)` you could probably simplify
> the arithmetic.
>
> Ivan
>
> On 25/11/2020 22:09, Frank Muller wrote:
>
> I’m new to GIS field, but this module states that Euclidian distance isn’t
> accurate compared to “Law of Haversines”:
>
>
>
> https://github.com/armon/teles/blob/master/src/teles_geo_query.erl#L87-L102
>
>
>
>
>
> /Frank
>
>
>
> Wed 25 nov. 2020 à 22:45, Ivan Uemlianin <ivan@REDACTED> wrote:
>
> Hi Frank
>
> Do you want to sort the list by Euclidean distance from X?  If so, could
> you use lists:sort/2?
>
> Ivan
>
>
> On 25/11/2020 21:38, Frank Muller wrote:
> > Hi guys,
> >
> > I've a list of geographic coordinates:
> >
> > L = [ {{<<"longitude">>,6.1457}, {<<"latitude">>,46.2022}},
> >       {{<<"longitude">>,2.3387}, {<<"latitude">>,48.8582}},
> >       ... ]
> >
> > and a specific coordinate X = {{<<"longitude">>,-73.5848},
> > {<<"latitude">>,45.4995}}.
> >
> > Question: how can i find the nearest coordinates to X from L (sorted
> > from the nearest to the farest)?
> >
> > /Frank
>
> --
> ============================================================
> Ivan A. Uemlianin PhD
> Llaisdy
>
> Ymchwil a Datblygu Technoleg Lleferydd
> Speech Technology Research and Development
>
>                      ivan@REDACTED
>                          @llaisdy
>                           llaisdy.wordpress.com
>                github.com/llaisdy
>                       www.linkedin.com/in/ivanuemlianin
>
>                          festina lente
> ============================================================
>
>
>
> --
>
> ============================================================
>
> Ivan A. Uemlianin PhD
>
> Llaisdy
>
>
>
> Ymchwil a Datblygu Technoleg Lleferydd
>
> Speech Technology Research and Development
>
>
>
>                     ivan@REDACTED
>
>                         @llaisdy
>
>                          llaisdy.wordpress.com
>
>               github.com/llaisdy
>
>                      www.linkedin.com/in/ivanuemlianin
>
>
>
>                         festina lente
>
> ============================================================
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20201126/936f70d8/attachment.htm>


More information about the erlang-questions mailing list