在Google地图应用程序中更改标记图标 [英] Changing markers icons in Google Maps application

查看:111
本文介绍了在Google地图应用程序中更改标记图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Jquery / javascript嵌入googlemap时,是否有一种简单的方法来更改标记?



编辑
加分问题
有没有方法可以使用地址而不是LatLng?

解决方案

Google Maps API V3现在是正式版本。 $ b

http://code.google.com/apis/maps/documentation/javascript/overlays.html#Icons



当您声明标记时,使用icon属性来设置图像。



  var image ='beachflag.png'; 
var myLatLng = new google.maps.LatLng(-33.890542,151.274856);
var beachMarker = new google.maps.Marker({
position:myLatLng,
map:map,
icon:image
});

您也可以使用图表API生成标记图片。



例如 http://chart.apis.google.com/chart ?chst = d_map_pin_letter& chld = A | FF0000 | 000000 针对红色针脚



http://groups.google.com/group/google-chart-api/web/ chart-types-for-map-pins?pli = 1


Is there an easy way to change the marker when embeding a googlemap with Jquery/javascript?

EDIT bonus Question Is there a way to use an address instead of LatLng?

解决方案

Google Maps API V3 is now the official version.

http://code.google.com/apis/maps/documentation/javascript/overlays.html#Icons

When you declare the markers use the "icon" property to set an image.

From the documentation:

 var image = 'beachflag.png';
  var myLatLng = new google.maps.LatLng(-33.890542, 151.274856);
  var beachMarker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      icon: image
  });

You can also use the charts API to generate marker images.

E.g. http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=A|FF0000|000000 for a red pin

http://groups.google.com/group/google-chart-api/web/chart-types-for-map-pins?pli=1

这篇关于在Google地图应用程序中更改标记图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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