如何使用 openlayers / cloudmade 添加到变量的简单链接?

发布于 2024-09-07 12:37:39 字数 1119 浏览 1 评论 0原文

这是我得到的代码;

 <script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>
  <script type="text/javascript">

    var cloudmade = new CM.Tiles.CloudMade.Web({key: '1b67988f99f947e3bd06fbcf924aeda1', styleId:19933});
    var map = new CM.Map('mapa', cloudmade);
    map.setCenter(new CM.LatLng(-24.900, -83.000), 4);

    var bottomRight = new CM.ControlPosition(CM.BOTTOM_RIGHT, new CM.Size(50, 20));
    map.addControl(new CM.SmallMapControl(), bottomRight);

    var CloudMadeIcon = new CM.Icon();
    CloudMadeIcon.image = "http://remidia.com.br/autopauta/wp-content/uploads/2010/marcador.gif";
    CloudMadeIcon.iconSize = new CM.Size(10, 10);


    var areiaGrande = new CM.LatLng(-9.253,-41.108);
    var areiaMarker = new CM.Marker (areiaGrande, {
    title: "Areia Grande (Casa Nova/BA)",
    icon: CloudMadeIcon, clickable:true, 

    });



    map.addOverlay(areiaMarker);




   </script>

如何添加链接(例如:href "http://www.areia.com") “areiaMarker”变量?

Here's the code I've got;

 <script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"></script>
  <script type="text/javascript">

    var cloudmade = new CM.Tiles.CloudMade.Web({key: '1b67988f99f947e3bd06fbcf924aeda1', styleId:19933});
    var map = new CM.Map('mapa', cloudmade);
    map.setCenter(new CM.LatLng(-24.900, -83.000), 4);

    var bottomRight = new CM.ControlPosition(CM.BOTTOM_RIGHT, new CM.Size(50, 20));
    map.addControl(new CM.SmallMapControl(), bottomRight);

    var CloudMadeIcon = new CM.Icon();
    CloudMadeIcon.image = "http://remidia.com.br/autopauta/wp-content/uploads/2010/marcador.gif";
    CloudMadeIcon.iconSize = new CM.Size(10, 10);


    var areiaGrande = new CM.LatLng(-9.253,-41.108);
    var areiaMarker = new CM.Marker (areiaGrande, {
    title: "Areia Grande (Casa Nova/BA)",
    icon: CloudMadeIcon, clickable:true, 

    });



    map.addOverlay(areiaMarker);




   </script>

How can I add a link (ex: href "http://www.areia.com") to the "areiaMarker" variable?

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

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

发布评论

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

评论(1

短暂陪伴 2024-09-14 12:37:39

无法在 CloudMade Web Maps API 中使用标题作为链接,但您可以使用 InfoWindow 代替。

这是一个示例: http://developers.cloudmade.com/项目/web-maps-api/examples/info-window

It's not possible to use title as a link in CloudMade Web Maps API, but you can use InfoWindow instead.

Here is an example: http://developers.cloudmade.com/projects/web-maps-api/examples/info-window

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