- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个应用程序,该应用程序使用谷歌 API 来获取传输解决方案,以便在所需时间到达某个位置。
我调用 google API 的代码在“驾驶”和“步行”旅行模式下完美运行,但在“公交”和“骑自行车”的情况下,响应始终标记为“ZERO_RESULTS”状态,并且不计算任何路线。
根据谷歌文档,这意味着在必须计算解决方案的国家/地区不提供过境和骑自行车。
我尝试了几个国家,我总是得到相同的结果,我也尝试了概述中的谷歌示例(用于过境),但它不起作用。
我通过 HTTPS 请求传递的参数是:出发地、目的地、出行方式、到达时间。
我尝试的第一件事是更改arrival_time,以防该值涉及过去或太遥远的 future ,但它不起作用。
如果我没有通过“arrival_time”,则响应是完美的,但我不明白,因为在 Google 文档中,arrival_time 是 https 请求的一个可能参数,也适用于过境旅行模式。没有这个论点,这个请求对我的目标毫无用处。
奇怪的是,如果我通过“过境”(到达或离开时间),响应是这样的:
{
"available_travel_modes" : [ "DRIVING", "WALKING" ],
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "ChIJu46S-ZZhLxMROG5lkwZ3D7k",
"types" : [ "locality", "political" ]
},
{
"geocoder_status" : "OK",
"place_id" : "ChIJ53USP0nBhkcRjQ50xhPN_zw",
"types" : [ "locality", "political" ]
}
],
"routes" : [],
"status" : "ZERO_RESULTS"
}
{
"available_travel_modes" : [ "DRIVING", "WALKING", "TRANSIT" ],
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "ChIJu46S-ZZhLxMROG5lkwZ3D7k",
"types" : [ "locality", "political" ]
},
{
"geocoder_status" : "OK",
"place_id" : "ChIJ53USP0nBhkcRjQ50xhPN_zw",
"types" : [ "locality", "political" ]
}
],
"routes" : [],
"status" : "ZERO_RESULTS"
}
https://maps.googleapis.com/maps/api/directions/json?origin=75+9th+Ave+New+York,+NY&destination=MetLife+Stadium+1+MetLife+Stadium+Dr+East+Rutherford,+NJ+07073&mode=transit&arrival_time=1391374800&key=YOUR_API_KEY
https://maps.googleapis.com/maps/api/directions/json?origin=Rome&destination=Milan&mode=transit&arrival_time=1513162800000&key=++API_KEY++
https://maps.googleapis.com/maps/api/directions/json?origin=Rome&destination=Milan&mode=transit&arrival_time=1513162800000&key=++API_KEY++
https://maps.googleapis.com/maps/api/directions/json?origin=41.9027835,12.496365500000024&destination=45.4642035,9.189981999999986&mode=transit&arrival_time=1513162800000&key=++API_KEY++
{
"available_travel_modes" : [ "DRIVING", "WALKING" ],
"geocoded_waypoints" : [ {}, {} ],
"routes" : [],
"status" : "ZERO_RESULTS"
}
https://maps.googleapis.com/maps/api/directions/json?origin=41.9027835,12.496365500000024&destination=45.4642035,9.189981999999986&mode=driving&arrival_time=1513162800000&key=++API_KEY++
{
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "EjJQaWF6emEgZGVsbGEgUmVwdWJibGljYSwgMTAsIDAwMTg1IFJvbWEgUk0sIEl0YWxpYQ",
"types" : [ "street_address" ]
},
{
"geocoder_status" : "OK",
"place_id" : "ChIJC5u9LazGhkcRXAZQFNDTpKc",
"types" : [ "street_address" ]
}
],
"routes" : [
{
"bounds" : {
"northeast" : {
"lat" : 45.4731019,
"lng" : 12.6177051
},
"southwest" : {
"lat" : 41.9028523,
"lng" : 9.1839517
}
},
"copyrights" : "Dati mappa ©2017 Google",
"legs" : [
{
"distance" : {
"text" : "573 km",
"value" : 572600
},
"duration" : {
"text" : "5 ore 51 min",
"value" : 21069
},
"end_address" : "Via Silvio Pellico, 2, 20121 Milano MI, Italia",
"end_location" : {
"lat" : 45.46495119999999,
"lng" : 9.1892874
},
"start_address" : "Piazza della Repubblica, 10, 00185 Roma RM, Italia",
"start_location" : {
"lat" : 41.9028523,
"lng" : 12.4964704
},
"steps" : [
{
"distance" : {
"text" : "93 m",
"value" : 93
},
"duration" : {
"text" : "1 min",
"value" : 19
},
"end_location" : {
"lat" : 41.9035781,
"lng" : 12.4959908
},
"html_instructions" : "Procedi in direzione \u003cb\u003enord\u003c/b\u003e da \u003cb\u003ePiazza della Repubblica\u003c/b\u003e verso \u003cb\u003eVia Giuseppe Romita\u003c/b\u003e",
"polyline" : {
"points" : "ycw~F}ugkAU?I@E@E@a@RG@EDED_@d@OP"
},
"start_location" : {
"lat" : 41.9028523,
"lng" : 12.4964704
},
"travel_mode" : "DRIVING"
},
// cut
{
"distance" : {
"text" : "52 m",
"value" : 52
},
"duration" : {
"text" : "1 min",
"value" : 14
},
"end_location" : {
"lat" : 45.4665738,
"lng" : 9.1889772
},
"html_instructions" : "Continua su \u003cb\u003eVia Santa Margherita\u003c/b\u003e",
"polyline" : {
"points" : "ogotGoxaw@`@`@j@h@"
},
"start_location" : {
"lat" : 45.4669622,
"lng" : 9.189359399999999
},
"travel_mode" : "DRIVING"
},
{
"distance" : {
"text" : "0,2 km",
"value" : 192
},
"duration" : {
"text" : "1 min",
"value" : 87
},
"end_location" : {
"lat" : 45.46495119999999,
"lng" : 9.1892874
},
"html_instructions" : "Svolta a \u003cb\u003esinistra\u003c/b\u003e e prendi \u003cb\u003eVia Silvio Pellico\u003c/b\u003e",
"maneuver" : "turn-left",
"polyline" : {
"points" : "aeotGcvaw@Xw@DCBAxC@~A?d@A"
},
"start_location" : {
"lat" : 45.4665738,
"lng" : 9.1889772
},
"travel_mode" : "DRIVING"
}
],
"traffic_speed_entry" : [],
"via_waypoint" : []
}
],
"overview_polyline" : {
"points" : "//collapsed//"
},
"summary" : "A1/E35 e A1",
"warnings" : [],
"waypoint_order" : []
}
],
"status" : "OK"
}
https://maps.googleapis.com/maps/api/directions/json?origin=41.9027835,12.496365500000024&destination=45.4642035,9.
189981999999986&mode=transit&key=++API_KEY++
{
"geocoded_waypoints" : [
{
"geocoder_status" : "OK",
"place_id" : "EjJQaWF6emEgZGVsbGEgUmVwdWJibGljYSwgMTAsIDAwMTg1IFJvbWEgUk0sIEl0YWxpYQ",
"types" : [ "street_address" ]
},
{
"geocoder_status" : "OK",
"place_id" : "ChIJRYxePKzGhkcRsgPwamn2Pfo",
"types" : [ "street_address" ]
}
],
"routes" : [
{
"bounds" : {
"northeast" : {
"lat" : 45.4969308,
"lng" : 12.5528041
},
"southwest" : {
"lat" : 41.892252,
"lng" : 9.188611
}
},
"copyrights" : "Dati mappa ©2017 Google",
"legs" : [
{
"arrival_time" : {
"text" : "13:55",
"time_zone" : "Europe/Rome",
"value" : 1513169733
},
"departure_time" : {
"text" : "10:10",
"time_zone" : "Europe/Rome",
"value" : 1513156231
},
"distance" : {
"text" : "571 km",
"value" : 571467
},
"duration" : {
"text" : "3 ore 45 min",
"value" : 13502
},
"end_address" : "Piazza del Duomo, 1, 20121 Milano MI, Italia",
"end_location" : {
"lat" : 45.4639037,
"lng" : 9.188611
},
"start_address" : "Piazza della Repubblica, 10, 00185 Roma RM, Italia",
"start_location" : {
"lat" : 41.9028429,
"lng" : 12.4964793
},
"steps" : [
{
"distance" : {
"text" : "0,1 km",
"value" : 102
},
"duration" : {
"text" : "1 min",
"value" : 87
},
"end_location" : {
"lat" : 41.902193,
"lng" : 12.4958041
},
"html_instructions" : "Cammina fino a Repubblica",
"polyline" : {
"points" : "wcw~F_vgkA@CBADABA@A@?B?D?B?B@B?B@BBB@@BBBDH@D@H@@?D?BDRBL?@DXBLBJDHBFVM"
},
"start_location" : {
"lat" : 41.9028429,
"lng" : 12.4964793
},
"steps" : [
{
"distance" : {
"text" : "54 m",
"value" : 54
},
"duration" : {
"text" : "1 min",
"value" : 49
},
"end_location" : {
"lat" : 41.9024775,
"lng" : 12.4962611
},
"html_instructions" : "Procedi in direzione \u003cb\u003esudest\u003c/b\u003e verso \u003cb\u003ePiazza della Repubblica\u003c/b\u003e",
"polyline" : {
"points" : "wcw~F_vgkA@CBADABA@A@?B?D?B?B@B?B@BBB@@BBBDH@D@H@@?D?B"
},
"start_location" : {
"lat" : 41.9028429,
"lng" : 12.4964793
},
"travel_mode" : "WALKING"
},
{
"distance" : {
"text" : "48 m",
"value" : 48
},
"duration" : {
"text" : "1 min",
"value" : 38
},
"end_location" : {
"lat" : 41.902193,
"lng" : 12.4958041
},
"html_instructions" : "Esci dalla rotonda e prendi \u003cb\u003ePiazza della Repubblica\u003c/b\u003e",
"polyline" : {
"points" : "oaw~FstgkADRBL?@DXBLBJDHBFVM"
},
"start_location" : {
"lat" : 41.9024775,
"lng" : 12.4962611
},
"travel_mode" : "WALKING"
}
],
"travel_mode" : "WALKING"
},
{
"distance" : {
"text" : "0,4 km",
"value" : 437
},
"duration" : {
"text" : "1 min",
"value" : 46
},
"end_location" : {
"lat" : 41.9011732,
"lng" : 12.4996019
},
"html_instructions" : "Metropolitana verso Anagnina",
"polyline" : {
"points" : "u_w~FwqgkAeBIBoA@I|ByM~CmELR"
},
"start_location" : {
"lat" : 41.902193,
"lng" : 12.4958041
},
"transit_details" : {
"arrival_stop" : {
"location" : {
"lat" : 41.9011732,
"lng" : 12.4996019
},
"name" : "Termini"
},
"arrival_time" : {
"text" : "10:12",
"time_zone" : "Europe/Rome",
"value" : 1513156353
},
"departure_stop" : {
"location" : {
"lat" : 41.902193,
"lng" : 12.4958041
},
"name" : "Repubblica"
},
"departure_time" : {
"text" : "10:11",
"time_zone" : "Europe/Rome",
"value" : 1513156307
},
"headsign" : "Anagnina",
"line" : {
"agencies" : [
{
"name" : "Atac",
"phone" : "011 39 06 57003",
"url" : "http://www.atac.roma.it/"
}
],
"color" : "#e27439",
"name" : "Metro A",
"short_name" : "MEA",
"url" : "http://muovi.roma.it/percorso/js?query=MEA&cl=1",
"vehicle" : {
"icon" : "//maps.gstatic.com/mapfiles/transit/iw2/6/subway2.png",
"local_icon" : "//maps.gstatic.com/mapfiles/transit/iw2/6/it-metro.png",
"name" : "Metropolitana",
"type" : "SUBWAY"
}
},
"num_stops" : 1
},
"travel_mode" : "TRANSIT"
},
{
"distance" : {
"text" : "2,6 km",
"value" : 2641
},
"duration" : {
"text" : "6 min",
"value" : 330
},
"end_location" : {
"lat" : 45.4639037,
"lng" : 9.188611
},
"html_instructions" : "Metropolitana verso San Donato",
"polyline" : {
"points" : "//collapsed//"
},
"start_location" : {
"lat" : 45.4844397,
"lng" : 9.202612799999999
},
"transit_details" : {
"arrival_stop" : {
"location" : {
"lat" : 45.4639037,
"lng" : 9.188611
},
"name" : "Duomo"
},
"arrival_time" : {
"text" : "13:55",
"time_zone" : "Europe/Rome",
"value" : 1513169730
},
"departure_stop" : {
"location" : {
"lat" : 45.4844397,
"lng" : 9.202612799999999
},
"name" : "Centrale FS"
},
"departure_time" : {
"text" : "13:50",
"time_zone" : "Europe/Rome",
"value" : 1513169400
},
"headsign" : "San Donato",
"line" : {
"agencies" : [
{
"name" : "COMUNE DI MILANO",
"phone" : "011 39 02 0202",
"url" : "http://www.muoversi.milano.it/"
}
],
"color" : "#ffea00",
"name" : "M3 - Linea Gialla",
"short_name" : "3",
"vehicle" : {
"icon" : "//maps.gstatic.com/mapfiles/transit/iw2/6/subway2.png",
"local_icon" : "//maps.gstatic.com/mapfiles/transit/iw2/6/it-metro.png",
"name" : "Metropolitana",
"type" : "SUBWAY"
}
},
"num_stops" : 4
},
"travel_mode" : "TRANSIT"
}
],
"traffic_speed_entry" : [],
"via_waypoint" : []
}
],
"overview_polyline" : {
"points" : "//collapsed//"
},
"summary" : "",
"warnings" : [
"Le indicazioni per tragitti a piedi sono in versione beta. Presta attenzione – questo percorso potrebbe non disporre di marciapiede o aree pedonali."
],
"waypoint_order" : []
}
],
"status" : "OK"
}
最佳答案
您请求中的问题是您作为 arrival_time
传递的值范围。请注意,此值必须以秒为单位:
arrival_time — Specifies the desired time of arrival for transit directions, in seconds since midnight, January 1, 1970 UTC. You can specify either departure_time or arrival_time, but not both. Note that arrival_time must be specified as an integer.
1513162800000
对应于
03/22/49920 @ 8:00am (UTC)
,正确值为
1513162800
对应于
12/13/2017 @ 11:00am (UTC)
.
https://maps.googleapis.com/maps/api/directions/json?origin=41.9027835%2C12.496365500000024&destination=45.4642035%2C9.189981999999986&mode=transit&arrival_time=1513162800&key=YOUR_API_KEY
关于google-maps - Google Directions API 公交返回总是 "ZERO_RESULTS",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47782514/
我正在使用谷歌地理编码 API 来获取结果,但它返回“ZERO_RESULTS”。下面是代码 public class GeoCode { public static void main(String
我已经将我之前为另一个 Web 应用程序编写的代码用于另一个。但是,没有明显的原因,它没有检索结果: Geocode was not successful for the following reas
我已经将我之前为另一个 Web 应用程序编写的代码用于另一个。但是,没有明显的原因,它没有检索结果: Geocode was not successful for the following reas
是my first question如果我设置默认的 lat 和 long 并且现在我尝试获取位置当前位置并使用它,那么它是有效的。我也关注这个Get User's Current Location
前言 我使用 Google Maps API 已经有一段时间了,之前能够成功使用距离矩阵服务 here .然后我决定进行一些重构,结果出现了问题...... 当前问题 当尝试获取距离矩阵服务的结果时,
我对路线服务 API 有疑问。是否有混合旅行模式设置可以让我绘制自行车路线,即使该特定街道上没有自行车道或者违反街道规则(是否可能)。我想画一条从A到B的路段,正好穿过选定的道路,而不是围绕该路实际上
我已经看到了几个关于为用户认为正确的地址获取 ZERO_RESULTS 的问题,这些问题通过更正使用错误(例如未能对地址进行 urlencode)或通过将地址调整为谷歌期望的形式(例如拼写出来)来解决
Google 距离矩阵 API 不断返回“ZERO_RESULTS”。我检查了我的请求两次,没有发现任何问题,请帮忙。 这是我的请求网址: https://maps.googleapis.com/ma
将监听器附加到 KML 图层: var layer = new google.maps.KmlLayer('http://sites.google.com/site/kmlprototypes/kml
我正在开发一个应用程序,该应用程序使用谷歌 API 来获取传输解决方案,以便在所需时间到达某个位置。 我调用 google API 的代码在“驾驶”和“步行”旅行模式下完美运行,但在“公交”和“骑自行
我正在尝试使用 Google map API 对用户输入的数据进行地理编码,但澳大利亚邮政编码“2010”出现错误 maps.google.com/maps/api/geocode/json?comp
我们使用 google API 进行地理编码。我们成功地对大约 10K 个地址进行了地理编码。出于某种原因,API 会为以下地址返回“地理编码错误:状态 = ZERO_RESULTS”。我们尝试了几次
我正在尝试使用 Geolocation API 和 Google Maps Geocoder 获取格式化的用户地址。一切都很好,但并非在每个地方都有效。例如,my address纬度42.646253
我正在处理 Google map KML 图层点击事件。 我正在使用这段代码: function initialize() { var mapOptions = { center: new
当我在 50 米最大半径内获得标记的全景时,有时它找不到全景,但如果我设置大约 60 米以上的半径,那么它就会起作用。 因此,我想自动再次请求半径为 +10 米的街道数据,如果在总长度 100 米内未
我有点问题, 我需要从道路名称(我提供的)中获取地点的坐标,我尝试使用 file_get_contents 和 json_decode 来实现,但是一些其中的一个不起作用(返回一个带有 ZERO_RE
我正在尝试使用 xcode 实现 google 的地理定位。当我传递带有纬度和经度的 url 时,它返回以下结果 ZERO_RESULTS 但是当我直接浏览 url 时。它给出了正确的结果。示
我正在使用 Google GeoCode API 从地址搜索位置并获取该位置的 LAT、LON 信息。 从 API 我总是得到 ZERO_RESULTS 就像我从谷歌地图搜索地址一样,它显示了位置 我
在这方面需要一些帮助。 我正在使用 Google Maps API v3 获取存储在我的数据库中的人类可读地址的纬度和经度,然后在 Google map Canvas 上放置 1 个标记。非常简单。
我使用以下发布方法: “myApiKey”代表我的 Google api key public static void post(){ try { Content resp =
我是一名优秀的程序员,十分优秀!