Calculate distance to shore or coastline for a vessel

后端 未结 3 675
闹比i
闹比i 2021-01-05 08:42

For a dataset of 200M GPS (lon, lat) coordinates of vessels I want to calculate an approximate distance to the nearest land or coastline, as a function called distance_to_sh

3条回答
  •  清歌不尽
    2021-01-05 09:17

    The key here is that you need to use the "great circle" (orthodromic) distance calculations, which are designed to find the distance between two points on the surface of a sphere. Although the earth is not a perfect sphere, such calculations will get you very close (to within 0.5%), and non-spherical adjustments can be applied if this isn't close enough.

    There are many documentations of this formula on the internet. You will want to look for closed form solutions that involve X-Y-Z instead of polar coordinates, or convert your GPS coordinates into polar, one of the two.

提交回复
热议问题