开发者

Google Maps distance to sea coast

开发者 https://www.devze.com 2022-12-22 14:05 出处:网络
Given just one point in Google Maps, is there anyway to know the distance to the nearest point in the coast (that is the minimun distance to the sea), and which point 开发者_如何学Pythonin the coast i

Given just one point in Google Maps, is there anyway to know the distance to the nearest point in the coast (that is the minimun distance to the sea), and which point 开发者_如何学Pythonin the coast it is?

Thanks in advance.


There is no documented method in the Google Maps API that will return the distance to the coast.

However, you may want to check out the following article:

  • Bill Chadwick's Google Maps API Demos (scroll to Distance Point to Polyline or Polygon)

The author describes a "point-to-polyline distance" function that was used with the GSHHS1 dataset to find out how far a point is to the sea.


1 GSHHS is a high-resolution shoreline data set amalgamated from two databases in the public domain. The data have undergone extensive processing and are free of internal inconsistencies such as erratic points and crossing segments. The shorelines are constructed entirely from hierarchically arranged closed polygons. The data can be used to simplify data searches and data selections, or to study the statistical characteristics of shorelines and land-masses. It comes with access software and routines to facilitate decimation based on a standard line-reduction algorithm.


I know this is a 7-year old question, but there is now a Distance to Coast REST API: https://www.kbgeo.com. It returns exactly what the OP requested - distance to the nearest coastal point and what that point is. JSON response:

{
  "distanceInMiles": 702.4893212372758,
  "targetPoint": {
    "lat": 43.045583,
    "lng": -89.3799951
  },
  "coastlinePoint": {
    "lat": 38.662389,
    "lng": -77.236111
  }
}

There's a live demo page at http://demo.kbgeo.com.

Disclosure: I wrote this API and therefore have a vested interest. However, it does exactly match OP's needs. Another API that does the same thing is maprisk.com.


You can use the following website for this calculation: http://www.distancetocoast.com/


we did something similar to that for Booli.se, on the map search functionality. For each listing we precompute the distance to the ocean by checking the point against the tiles served by google. Check for water color in the image, and calculate the distance. I'm afraid that there is no pre-built functionality for this.

0

精彩评论

暂无评论...
验证码 换一张
取 消