天地图加marker和popup

//—————–加marker—————————–

 

var Layer = new GeoSurf.Layer.Markers(“MarkerLayer”);
 map.addLayer(Layer);

 

var markerIcon = new GeoSurf.Icon();

markerIcon.url = “icon/star.gif”;

markerIcon.size = new GeoSurf.Size(18,18);

 

var lonlat = new GeoSurf.LonLat(116.4, 30.4);

 

var marker = new GeoSurf.Marker(lonlat, markerIcon);

 

map.addLayer(Layer);
Layer.addMarker(marker);

 

//—————给marker加popup————————–

 

marker.events.register(“mousedown”, marker, function(){
      var contentHTML =”<div>” +
                                   “纬度:” + Lat + “°” +
                                    “经度:” + Lon + “°” +
                                   “<//div>”;
      var popup = new GeoSurf.Popup(“chicken”,lonlat,new GeoSurf.Size(200,200),contentHTML,true);
      popup.closeOnMove = true;
      map.addPopup(popup);
     });

转载自:https://blog.csdn.net/zhang88lei/article/details/6096664

You may also like...