简体   繁体   English

Google Maps API指南中的标识符

[英]Identifier in Google Maps API directions

I have a question that I can't seem to find the solution to. 我有一个问题,我似乎无法找到解决方案。 I'm no stranger to the Google Maps API and have coded maps and driving direction pages with it in the past. 我对谷歌地图API并不陌生,并且过去使用它编码地图和驾驶方向页面。 The issue I'm always running into is not having the place name returned in the results for the origin, destination, or any waypoints. 我一直遇到的问题是没有在原点,目的地或任何航点的结果中返回地名。 The directions come back arranged the way I set them but the addresses are always "formatted" and not hot the directions (with place names) I send. 方向回来按照我设置的方式排列,但地址总是“格式化”而不是我发送的方向(带地名)。

So my question is this: Is there any way to preserve the place name so that it displays in the address on the directions pane? 所以我的问题是:有没有办法保留地名,以便它显示在路线窗格的地址中?

Example: Data sent: "John Smith, 570 Washington Street, Nowhere, TN 33002" Data returned: "570 N Washington Street, Nowhere, TN 33002, USA" 示例:发送的数据:“John Smith,570 Washington Street,Nowhere,TN 33002”数据返回:“570 N Washington Street,Nowhere,TN 33002,USA”

No name or identifier, just the address. 没有名称或标识符,只有地址。 Any pointing in the right direction would be greatly appreciated. 任何指向正确方向的人都将非常感激。 . . And please don't send mail to John Smith now... he hates that. 请不要发送邮件给约翰史密斯......他讨厌这个。

What you need to do is: 你需要做的是:

1) suppress the directionsDisplay generated markers & info window (which holds the address) 1)抑制directionsDisplay生成的标记和信息窗口(保存地址)

2) Place your own markers & info windows 2)放置自己的标记和信息窗口

To complete 1) - you need to: 要完成1) - 你需要:

directionsDisplay = new m.DirectionsRenderer({supressMarkers: true,
suppressInfoWindows: true});

for 2) - you should simple create a marker as usual. 对于2) - 你应该像往常一样简单地创建一个标记。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM