我如何查看多边形图层

问题描述

如何在地图上以wkt格式显示保存在数据库中的多边形,您可以帮忙吗?我不知道该怎么办,因为我刚刚开始进行制图业务

绘制完这样的图后,我进行了注册,但是我不知道如何在地图上查看数据库中的记录。

我试图按如下方式查看它,但是我无法拉出我的wkt类型坐标。

function ListPolygon() {
    $.ajax({
        type: "Get",url: "/Home/ListPolygon",dataType: 'json',success: function (response) {
            var _features = [];
            for (var i = 0; i < response.length; i++) {
                var format = new ol.format.WKT();
                var _poly = response[i];
                var _id = _poly.Id;
                var wkt = _poly.MahalleKordinant;
                var _geo = new ol.geom.Polygon([format.readFeature(wkt)]);


                var featurething = new ol.Feature({
                    name: "Mahalle",geometry: _geo,});
                featurething.setId(_id)

                var _style = new ol.style.Style({
                    fill: new ol.style.Fill({
                        color: 'rgba(255,200,155,0.8)'
                    }),stroke: new ol.style.Stroke({
                        color: '#ffcc33',width: 3
                    }),image: new ol.style.Circle({
                        radius: 6,fill: new ol.style.Fill({
                            color: '#ffcc33'
                        })
                    })
                });
                featurething.setStyle(_style);

                _features.push(featurething);
            }
            var _polysource = mahalle_layer.getSource().getExtent();

            _polysource.addFeatures(_features);
        },error: function () {
            alert("Hata");
        },});
}

ListPolygon();

我以这种方式进行了编辑,但控制台收到了此错误。

enter image description here

enter image description here

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...