在maps.google.com上使用自定义标记制作Google地图

发布于 2024-10-07 13:40:10 字数 208 浏览 0 评论 0原文

我目前正在使用 Google Maps v.3 API 在我的网站上的数据库中生成自定义位置地图。数据库查询中出现的每个位置都会有一个标记和一个显示其名称和地址的简单信息窗口。不过,我想让用户也可以选择查看 Google 网站 (maps.google.com) 上的地图,以便他们可以在那里访问行车路线。有什么办法可以做到这一点吗?我正在考虑动态导入 GeoRSS 提要的事情,但我不知道这是否可能。

I'm currently using the Google Maps v.3 API to generate a custom map of locations in my database on my site. Each location that turns up in the database query is given a marker and a simple Info Window that displays its name and address. However, I'd like to give users the option of also looking at the map on Google's site (maps.google.com) so that they can access driving directions there. Is there any way to do this? I was thinking something the along the lines of dynamically importing a GeoRSS feed, but I don't know if that's possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

二手情话 2024-10-14 13:40:10

用户可以点击地图左下角的 Google 徽标来转到标准的 google 地图页面。或者可以从您的地图构建一个 URL 并将其发送到新页面。这是我使用的一个功能为用户提供一个可以粘贴到其他地方的 URL。您可以在 window.open javascript 函数中使用类似的代码:

function GenerateLink(){
var url;
url = "http://maps.google.com/?ll=" + map.getCenter().lat() + "," + map.getCenter().lng() + '&z=' + map.getZoom(); 
prompt("You can copy this link using CTRL-C, its a direct link to Google Maps for the current map center and zoom level", url);
}

Duncan。

Users can click on the Google Logo on the bottom left hand side of the map to go to a standard google maps page.. alternatively can build up a URL from your map and send them off to a new page.. here's a function I use to give Users a URL that they can paste into other places.. you could use similar code with the window.open javascript function:

function GenerateLink(){
var url;
url = "http://maps.google.com/?ll=" + map.getCenter().lat() + "," + map.getCenter().lng() + '&z=' + map.getZoom(); 
prompt("You can copy this link using CTRL-C, its a direct link to Google Maps for the current map center and zoom level", url);
}

Duncan.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文