首页 / 浏览问题 / WebGIS / 问题详情
classic 有没有纯文本和自定义html的地图标记
25EXP 2020年08月05日

classic 有没有纯文本和自定义html的地图标记如下图,纯文本是为了实现对一些地图标记附上文字说明,自定义图文标记是为了能够实现图片+html的多样设计

ps. 这些标记需要能够通过设置经纬度坐标定位在地图的指定位置

纯文本标记:

自定义html标记:

1个回答

您好

1.文本

      var point = new SuperMap.Geometry.Point(0, 0);
        pointFeature = new SuperMap.Feature.Vector(point);
        pointFeature.style = {
                strokeColor: "#CAFF70",
                fillColor: "#DC143C",
                strokeWidth: 2,
                fillOpacity: 0.8,
                fontWeight: "bold",
                label: "东方\n Eastern",
                fontColor: "#FFF0F5"

            };
        vectorlayer.addFeatures(pointFeature);

2.制作标签专题图的形式

可参考https://iclient.supermap.io/examples/classic/editor.html#theme_themeLabelLayer

   //新建一个策略
    strategy = new SuperMap.Strategy.GeoText();
    //新建一个标签专题图层
    vectorLayer = new SuperMap.Layer.Vector("Label", {strategies: [strategy]});

    //设置标签的样式
    strategy.style = {
        fontColor: "#FF7F00",
        fontWeight: "bolder",
        fontSize: "14px",
        fill: true,
        fillColor: "#FFFFFF",
        fillOpacity: 1,
        stroke: true,
        strokeColor: "#8B7B8B"
    };
 

3,352EXP 2020年08月05日
...