On 17 June 2010 16:05, Rossko <[email protected]> wrote: >> which acts as >> a boundary for route-planning? > > You can't do that with Google's Directions service, so first of all > you will have to build your own routing engine and database.
I had read that requirement as "ensuring the end-points of the route are within the polygon", which is fairly easy to do with something like .Contains() from Mike's EPoly extension. If it means "ensure every part of the route is within the polygon" then that is far more difficult, but you can still check fairly easily that each node of the returned route, again with .Contains(). If the DirectionsService of Version 3 is used, then that will provide alternative routes, so it would be possible to reject routes where a node is outside the polygon and provide one or more of the alternatives which do satisfy the condition. In this case, the point-in-polygon analysis would need to be written for Version 3. Neither of those methods would necessarily catch a route which passed through the polygon boundary more than once between nodes which both lay inside. That would be possible but torturous, involving the examination of each segment of the line and testing whether it crossed any segment of the boundary. -- You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-api?hl=en.
