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:
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 ?