calculating curvature on routes - Google maps

Viewed 2522

There is an API for getting heatmap and gradient on the Google Maps API.

But is there any way to calculate curvature of the road of certain route on Google Maps?

Like this one in here: roadcurvature.com

1 Answers

There's no way to calculate the curvature of all roads using the Google Maps API, but you can certainly calculate the curvature of a route that you've found using the Directions API / Service.

The JavaScript API's DirectionsService response will include an overview_path with a series of LatLngs that make up the path. From that point, it's just a question of taking those points and applying the same sort of analysis documented here by the RoadCurvature project. The project uses OSM to simplify the collection and analyze large swaths of data, but if you want to just analyze a specific route the math is still the same. In particular, I would look at the curvature/post_processors/add_* files which appear to do the heavy lifting.

Related