Pregunta

I'm working on a website, which can store your locations, the routes between them and it checks the daily speedcams ( like ' city, street/road ' ) and if there's a match it sends an email. My problem is when i got the response from the directions request, i only get the starting and ending coordinate of each step, which sometimes isn't even part of the road. For example there's a highway on the route, but i only got frrom the response the place where i drive on and off the highway.. There can be a speedcam between the two, but i can't check it because i only got the nearest city address where the route "enters" or leaves the highway.. Is there a way that i can create an array or something with all the street names that are precisely on the road? Like XY street, XX road, XXY avenue, XCX street, YY road, YX street.

Sorry for my lame english and thank you for any help!

¿Fue útil?

Solución

One of the elements of a directions API response is an encoded polyline. This is the polyline.points attribute. You can decode this - using PHP for example to obtain a list of lat-long coordinates. This will give you the actual path of the route to use with your data.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top