我正在尝试了解DistanceMatrix API。当我在浏览器上执行此操作时:
https://maps.googleapis.com/maps/api/distancematrix/json?origins=14.614786,121.046587&destinations=14.610301,121.080233&mode=driving&language=zh-CN&departure_time=now&key=MY_KEY
我得到了duration_in_traffic。
{
"destination_addresses" : [
"17 Orchard Rd, Bagumbayan, Quezon City, 1109 Metro Manila, Philippines"
],
"origin_addresses" : [ "74 C. Benitez St, Quezon City, Metro Manila, Philippines" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "8.5 km",
"value" : 8470
},
"duration" : {
"text" : "23 mins",
"value" : 1406
},
"duration_in_traffic" : {
"text" : "35 mins",
"value" : 2112
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
但是当我使用地图API将其放在golang中时
我没有得到duration_in_traffic并且只返回null
r := &maps.DistanceMatrixRequest{
Language: *language,
DepartureTime: "now",
ArrivalTime: *arrivalTime,
}
我做错了什么吗?
喵喵时光机
相关分类