【问题标题】:Meteor: unable to customize marker of google map流星:无法自定义谷歌地图的标记
【发布时间】:2014-08-05 00:34:20
【问题描述】:

我正在使用流星(0.8.2)进行项目。在这个项目中,我使用了 google maps api。地图的默认标记工作正常,但是当我尝试用“image.png”替换它们时,图像图标在地图上不可见。对此有什么想法吗?

我的代码:

for (var i = 0, place; place = places[i]; i++) {
      var image = {
      url: 'markerimage.png',// image is in root directory of meteor project.
      size: new google.maps.Size(71, 71),
      origin: new google.maps.Point(0, 0),
      anchor: new google.maps.Point(17, 34),
      scaledSize: new google.maps.Size(35, 35)
      };

      // Create a marker for each place.
      var marker = new google.maps.Marker({
      map: map,
      icon: image,
      title: place.name,
      animation: google.maps.Animation.DROP,
      position: place.geometry.location
      });

      markers.push(marker);

      bounds.extend(place.geometry.location);

    }

【问题讨论】:

    标签: meteor google-maps-markers


    【解决方案1】:

    将您的图像放在项目根目录下名为“public”的目录中。

    然后使用“/markerimage.png”引用您的图像

    放置在公用文件夹中的每个文件都作为静态资产提供给客户端,请参阅文档了解更多信息。

    【讨论】:

      猜你喜欢
      • 2013-08-21
      • 1970-01-01
      • 2015-10-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多