The Routes API can return information about the following route features, when known:
- Flyovers: Information about elevated road segments, such as overpasses and bridges.
- Narrow roads: Information about roads that are deemed to be more narrow than normal.
No visual indicators are provided on the map.
Supported countries: India only
Why use it
Use the flyover and narrow route options to notify your users of these features. For example, provide alerts or visual indicators on the maps so that drivers using your app can readily anticipate these routes and adjust their driving accordingly.
For instructions, see the following sections:
Request flyover information
Your request must meet the following criteria:
- Request a route in India.
- Set
travelMode
toDRIVE
orTWO-WHEELER
. - Include
"extraComputations": ["FLYOVER_INFO_ON_POLYLINE"]
. - Include a field mask for these fields:
routes.polyline_details.flyover_info
routes.polyline
- Don't include the
optimizeWaypointOrder
parameter.
For details, see
PolylineDetails.FlyoverInfo
.
Example request: Flyover information
curl -X POST -d '{ "origin": { "location": { "latLng": { "latitude": 28.57580734159006, "longitude": 77.02719067373043 } } }, "destination": { "location": { "latLng": { "latitude": 28.595737365438477, "longitude": 77.16870453065245 } } }, "travelMode": "DRIVE", "extraComputations": ["FLYOVER_INFO_ON_POLYLINE"] }\ -H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \ -H 'X-Goog-FieldMask: routes.polyline_details.flyover,routes.polyline' \ 'https://routes.googleapis.com/directions/v2:computeRoutes'
Example response: Flyover information
{
"routes": [{
"polyline": {
"encodedPolyline": "selmD}jcuM?oBcDAqEF}DCOOZuCfAwJFMJM\\_Cd@mEv@gFHQF_C?eIGe@_@{@g@u@MY@Wz@cCp@}AF_@MeC?kLFy@xZpBxRlAdJj@zCPlBRxPfApP|@`@MVUHQv@iF~@aFfAeEnA_EpAgD`@kAjCeF~FiKPa@NOx@iApAyCtA{C`@wAEg@Ba@Xq@TU`@MZCLY^QPQx@kAn@cAh@s@^YZ]fA{@lAs@bBy@`DiAtDwAdB_ARCP@z@m@dAeAbA_BpAcCd@oAr@eBRe@nEsIjAiBdAuBZw@n@{BTsANi@p@wAJ]h@wCr@oEr@yEvAwI`AuGt@gG`@oEt@wFr@}FpB_N`CiQ`AqGVoAbEcP^_Br@uDr@yEPqA^cEj@iERyCReEf@}GvBkQXwATgC@_@AYK]u@wAGa@IoHFaEFoAXuDVqBdBsLb@qDRuCRaELu@Rs@d@u@lBaC\\o@Tm@VwANcAHmADuCCsAKo@YkAU}@AQ@WHa@iJyTs@uAe@q@c@i@oA_AuAw@kBu@iEwAuDoA_JeDiB}@qAaA]a@u@gAeAoB_CoG}@eCgAoCw@wAsByCe@i@iCmDmAmB}BeDu@aAaHyJ_BwBCEyBaD}AkBu@u@uAy@gBw@yAc@gFoAiKmC}E{@eCk@sF}@YCwDIqDG{Tq@mB@_Ne@k@AoBGkAKaB]{Am@gBkAcAgAcBeCmAwBwAwCmDeGq@yAcAwCmCgJQu@i@gAw@mAaAkA{@u@oAu@eAe@kAa@}GcBEAkDq@aAWkKaBqDq@oMuBuBc@e@Ok@Wm@e@_AaAm@aA[}@a@uAy@aDmCmJSi@cAmDsEyNgAaDcDeKEo@gAkDkD{I_AyCg@qBeAqEU_AgA_D[{@gBoGaDaIqDaIYs@"
},
"polylineDetails": {
"flyoverInfo": [{
"flyoverPresence": "EXISTS",
"polylinePointIndex": {
"startIndex": 153,
"endIndex": 173
}
}, {
"flyoverPresence": "EXISTS",
"polylinePointIndex": {
"startIndex": 190,
"endIndex": 213
}
}]
}
}]
}
Request narrow road information
Your request must meet the following criteria:
- Request a route in India
- Set
travelMode
toDRIVE
. - Include
"extraComputations": ["NARROW_ROAD_INFO_ON_POLYLINE"]
Include a field mask for these fields:
routes.polyline_details.narrow_road_info
routes.polyline
.
Don't include the
optimizeWaypointOrder
parameter.
For details, see
PolylineDetails.NarrowRoadInfo
.
Example request: Narrow road information
curl -X POST -d '{ "origin": { "location": { "latLng": { "latitude": 12.9598336, "longitude": 80.1659834 } } }, "destination": { "location": { "latLng": { "latitude": 12.9593739, "longitude": 80.1723585 } } }, "travelMode": "DRIVE", "extraComputations": ["NARROW_ROAD_INFO_ON_POLYLINE"] }\ -H 'Content-Type: application/json' -H 'X-Goog-Api-Key: YOUR_API_KEY' \ -H 'X-Goog-FieldMask: `routes.polyline_details.narrow_road_info`,routes.polyline' \ '[https://routes.googleapis.com/directions/v2:computeRoutes](https://routes.googleapis.com/directions/v2:computeRoutes)'
Example response: Narrow roads
{
"routes": [{
"polyline": {
"encodedPolyline": "{ebnA_mhhNqAGGeD?aAFq@Xy@Re@Jm@FmABOHOTQBYWgIBiHBo@j@@d@@"
},
"polylineDetails": {
"narrowRoadInfo": [{
"narrowRoadPresence": "EXISTS",
"polylinePointIndex": {
"startIndex": 15,
"endIndex": 16
}
}]
}
}]
}
Supported regions
Flyovers and narrow roads are supported in India only.
Billing
Google Maps Platform does not charge extra for the use of an experimental feature. You will be charged based on your usage of the API based on other parameters you set.
Learn more about billing for the Routes API.