Search code examples
javahadoopdistanceesrigeo

Distance Calculation with a requested set of points


I have a requirement to determine the distance from each point (lat/long) to every other point in the submitted collection. It could be 2 to 200 points. A formula like Haversine is a requirement. For example A,B,C would return A-B - x.x meters, A-C - x.x meters, B-C = x.x meters.

I am considering options like a custom solution in Java OR possibly leverage distributed computing like Hadoop / Apache Spark OR a tool like a GeoProcessing tool (ESRI/ARCGIS).

Has anyone tackled this requirement before?

Any lessons learned?


Solution

  • For distance in meters between points with (lon,lat) coordinates [note X,Y order] with the Esri Spatial Framework for Hadoop, use ST_GeodesicLengthWGS84.

    More samples of ST_GeodesicLengthWGS84 can be found in this test script.

    Related Q/A on GIS-SE: https://gis.stackexchange.com/questions/170479/join-on-range-query-using-esris-gis-tools-for-hadoop/#185660

    [Disclosure: collaborator.]

    update: Java API - GeometryEngine.html#geodesicDistanceOnWGS84