相关疑难解决方法(0)

OpenLayers,很棒的标记聚类

你知道如何在OpenLayers中有一个很好的聚类,比如这个谷歌的例子吗?

javascript openlayers markerclusterer

22
推荐指数
4
解决办法
3万
查看次数

Openlayers:矢量特征而不是标记

我想在地图上放置一个符号.例如

地图示例

到目前为止,我已经使用OpenLayers OpenLayers.Layer.Markers.代码如下所示:

    map = new OpenLayers.Map('map');
    layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
    map.addLayer(layer);
    map.setCenter(
        new OpenLayers.LonLat({{ location.lon }}, {{ location.lat }}).transform(
            new OpenLayers.Projection("EPSG:4326"),
            map.getProjectionObject()
        ), 15);

   var lonLat = new OpenLayers.LonLat({{ location.lon }}, {{ location.lat }})
             .transform(
               new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
               map.getProjectionObject() // to Spherical Mercator Projection
             );
   var markers = new OpenLayers.Layer.Markers( "Markers" );
   map.addLayer(markers);
   markers.addMarker(new OpenLayers.Marker(lonLat));
Run Code Online (Sandbox Code Playgroud)

这可以作为例外,并显示上面的地图.但我无法使用Vector替换最后3行:

     vectors = new OpenLayers.Layer.Vector("Vector Layer");
     vectors.addFeatures([new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(lonLat))]);
     map.addLayer(vectors);
Run Code Online (Sandbox Code Playgroud)

是否需要使用特殊魔法OpenLayers.Feature.Vector

openlayers

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

openlayers ×2

javascript ×1

markerclusterer ×1