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
Where degree of curvature is based on 100 units of arc length, the conversion between degree of curvature and radius is Dr = 18000/π ≈ 5729.57795, where D is degree and r is radius.
Google Maps does not support the radius functionality, which means that you can't determine the radius around a given location. But you can measure the distance between two or more points. As a quick reminder, the radius of a circle is the distance from its edge to its center.
GPS data from individual phones is now used by Google Maps to estimate movement and speed of traffic in real time. This data informs Google's travel time estimates by reducing the average speeds in its calculations during periods of high traffic, or increasing the average speed when conditions are clear.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With