如何添加商家/“默认”位置标记和infoWindow到谷歌地图(v3) [英] How to add a business/"default" location marker and infoWindow to Google Maps (v3)

查看:176
本文介绍了如何添加商家/“默认”位置标记和infoWindow到谷歌地图(v3)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在maps.google.com中添加商家位置标记与其中的DEFAULTINFOWINDOW泡泡?



我正在联系



示例:



转到maps.google.com并搜索斗兽场(例如,任何已知的位置/业务都会这样做)。当你点击斗兽场标志时,你会得到一个infoWindow,它具有商业/视线/窗口中的任何信息(截图: https://dl.dropbox.com/u/1122582/colosseum.jpg

我想看的是:




  • 当我在我的网页上点击我地图上的标记时,它会打开相同样式(或至少非常相似)的infoWindow,示例(这意味着徽标,地址,方向链接等)。 InfoWindow是由API选项提供的,而不是由我手工制作的。



在伪代码中,我会想象看到它是这样的: p>

  myMarker.onClick({
位置:myBusinessLocation,
useDefaultInfoWindow:true
map:myMap
});

值得注意的是,由于坐标实际上只是坐标和命名位置,所以我需要让API理解标记指向一个企业,而不仅仅是地图上的一个点。



要求




  • 客户端API使用

  • 无需使用Google的IFRAME嵌入

  • 无需制作自定义infoWindow,这个例子。总的来说,我会使用默认infoWindow(如果GMaps API甚至提供了一个)
  • >

    没有内置方法可以自动创建具有所需内容的infoWindow。

    这是API的本质,它必须提供这种能力创建应用程序,但不能自动创建应用程序。



    您必须自行创建infoWindow。已实施的 infoWindow - 对象。



    您也必须自行收集infoWindow的内容,您可以使用地点详情请求


    Is is possible to add a business location marker WITH IT'S "DEFAULT" INFOWINDOW bubble like the ones in maps.google.com?

    I'm making a contact page for a a company, where I have the GMaps element with a location and a marker, naturally.

    Example:

    Go to maps.google.com and search for "Colosseum" (for example, any "known" location/business will do). When you click the Colosseum marker, you get an infoWindow that has the business/sight/whatever info in the window (screenshot: https://dl.dropbox.com/u/1122582/colosseum.jpg)

    What I want to see, is:

    • When I click the marker on my map on my webpage, it will open the same style (or atleast very similar) infoWindow as in the example (this means logo, address, direction links etc. whatever it has). InfoWindow being provided by the API options, and not handmade by me.

    In pseudocode, I would imagine seeing it like this:

    myMarker.onClick({
        position: myBusinessLocation,
        useDefaultInfoWindow: true
        map: myMap
    });
    

    Worth noting that since coordinates are actually just coordinates and named locations, I would need to make the API understand the Marker points to a business, and not just a point in the map.

    Requirements

    • Client-side API usage
    • WITHOUT the use of Google's IFRAME embedding
    • WITHOUT making a custom infoWindow that just looks like the one in the example. The whole point is that I would use the "default" infoWindow (if GMaps API even provides one)

    解决方案

    There is no built-in method to create such an infoWindow with the desired content automatically.

    That's the nature of an API, it has to offer the ability to create an application, but must not create an application automatically.

    You have to create the infoWindow on your own by using e.g. the implemented infoWindow-object.

    The contents of the infoWindow you also must collect on your own, you may retrieve the details for a place by using a Place-Details-Request

    这篇关于如何添加商家/“默认”位置标记和infoWindow到谷歌地图(v3)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆