I try to create an application for taxis. The application will be GMap based.

On the map will be marked the region in which the taxi driver is working in.

The region will be a polygon designed by the application owner.

Also the client charge will be based on kilometer.

The end user can define the departure and destination points on the map. In case that both locations are inside the region all are fine.

In case the destination point is outside the region, the client must be charged in double rate for the kilometers outside the region.

What I like to ask is the following:

  • Is there a way to know what is the distance from the point inside the region until the region border?
  • And what is the distance from the point outside the region until the region border?

To be more specific, I attach an image here:

enter image description here

What I need is to get the distance from departure location to the border of the region (the yellow circle) and from yellow circle to the destination location.

I know that this is very complex, but I don't even know if is possible.

Can somebody to help me with that problem ?

closed as too broad by PolyGeo Apr 28 '18 at 7:27

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    You need a spatial database (like postgres/postgis) backend for this solution. – Mapperz Nov 27 '12 at 14:51
  • This will be a WordPress plugin, so I can have a database access to write data. Can you please brovide me with any further information on how to implement the distance calculation in Google Maps, from starting point to the borders and from destination point to the borders too ? – Merianos Nikos Nov 27 '12 at 14:55
  • 1