calculating curvature on routes - Google maps
Asked Answered
W

1

11

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

Wallflower answered 10/11, 2017 at 14:49 Comment(4)
Given any two segments of a route, you can calculate the radius of a circle for whom those two segments are tangents, but I guess you mean to get an arbitrary measure to diagnose the overall curvature for a route of N segments.Mycorrhiza
@amenadiel yes exactlyWallflower
Why don't you use their method, describe on the website? roadcurvature.com/technologyBenign
@Benign because they use Open Street Map (OSM) projectWallflower
L
1

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.

Lucindalucine answered 17/11, 2018 at 20:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.