无法为 google 地图距离矩阵设置模式
Unable to set mode for google maps distance matrix
我正在遵循此指南:https://developers.google.com/maps/documentation/distance-matrix/distance-matrix
这个请求对我来说很好:
$ curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&mode=DRIVING&key=<API_KEY>'
{
"destination_addresses" : [ "San Francisco, CA, USA" ],
"origin_addresses" : [ "Seattle, WA, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "1,300 km",
"value" : 1299780
},
"duration" : {
"text" : "12 hours 44 mins",
"value" : 45815
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
但是当我尝试添加参数 mode=WALKING
时的结果完全相同。
我试过多个地点,我总是得到相同的行驶距离和持续时间。
如何获得 walking
结果?目前我在更新 mode
.
时没有看到任何差异
如果我使用记录的参数 &mode=walking
,我会得到不同的结果值
{
"destination_addresses" : [ "San Francisco, CA, USA" ],
"origin_addresses" : [ "Seattle, WA, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "1,383 km",
"value" : 1383163
},
"duration" : {
"text" : "11 days 10 hours",
"value" : 987899
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
mode
For the calculation of distances and directions, you may specify the transportation mode to use. By default, DRIVING mode is used. By default, directions are calculated as driving directions. The following travel modes are supported:
- driving (default) indicates standard driving directions or distance using the road network.
- walking requests walking directions or distance via pedestrian paths & sidewalks (where available).
- bicycling requests bicycling directions or distance via bicycle paths & preferred streets (where available).
- transit requests directions or distance via public transit routes (where available). If you set the mode to transit, you can optionally specify either a departure_time or an arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference.
我正在遵循此指南:https://developers.google.com/maps/documentation/distance-matrix/distance-matrix
这个请求对我来说很好:
$ curl -L -X GET 'https://maps.googleapis.com/maps/api/distancematrix/json?origins=Seattle&destinations=San+Francisco&mode=DRIVING&key=<API_KEY>'
{
"destination_addresses" : [ "San Francisco, CA, USA" ],
"origin_addresses" : [ "Seattle, WA, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "1,300 km",
"value" : 1299780
},
"duration" : {
"text" : "12 hours 44 mins",
"value" : 45815
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
但是当我尝试添加参数 mode=WALKING
时的结果完全相同。
我试过多个地点,我总是得到相同的行驶距离和持续时间。
如何获得 walking
结果?目前我在更新 mode
.
如果我使用记录的参数 &mode=walking
{
"destination_addresses" : [ "San Francisco, CA, USA" ],
"origin_addresses" : [ "Seattle, WA, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "1,383 km",
"value" : 1383163
},
"duration" : {
"text" : "11 days 10 hours",
"value" : 987899
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
mode
For the calculation of distances and directions, you may specify the transportation mode to use. By default, DRIVING mode is used. By default, directions are calculated as driving directions. The following travel modes are supported:
- driving (default) indicates standard driving directions or distance using the road network.
- walking requests walking directions or distance via pedestrian paths & sidewalks (where available).
- bicycling requests bicycling directions or distance via bicycle paths & preferred streets (where available).
- transit requests directions or distance via public transit routes (where available). If you set the mode to transit, you can optionally specify either a departure_time or an arrival_time. If neither time is specified, the departure_time defaults to now (that is, the departure time defaults to the current time). You can also optionally include a transit_mode and/or a transit_routing_preference.