首页 / 浏览问题 / 云GIS / 问题详情
图片旁可以加一个显示属性的标注吗?
8EXP 2020年06月20日
根据坐标,在对应位置绘制图片,并显示时间及属性信息,如何设置属性并显示属性?

1个回答

您好,您具体可以参考https://iclient.supermap.io/examples/openlayers/editor.html#02_editFeatures        

  pointFeature = new ol.Feature(new ol.geom.Point(point));
            pointFeature.setStyle(new ol.style.Style({
                image: new ol.style.Circle({
                    fill: new ol.style.Fill({
                        color: [255, 0, 0, 0.5]
                    }),
                    stroke: new ol.style.Stroke({
                        color: 'red',
                        width: 2
                    }),
                    radius: 8
                })
            }));
            pointFeature.setProperties({POP: 1, CAPITAL: 'test'});

        map.forEachFeatureAtPixel(e.pixel, function (feature) {
            if (feature.getProperties().CAPITAL) {
                map.getTargetElement().style.cursor = 'pointer';
                var contentHTML = feature.getProperties().CAPITAL;
                content.innerHTML = contentHTML;
                overlay.setPosition(feature.getGeometry().getCoordinates());
                map.addOverlay(overlay);
                select = true
            }
        }

3,352EXP 2020年06月22日
...