openlayers6 mapserver加载地图底图

openlayers6 mapserver加载地图底图,第1张

import 'ol/olcss'

import {Map, View, Feature}from 'ol'

import VectorLayerfrom "ol/layer/Vector";

import VectorSourcefrom "ol/source/Vector";

import TileLayerfrom "ol/layer/Tile";

import TileWMSfrom 'ol/source/TileWMS';

import XYZfrom "ol/source/XYZ";

import Proj, {transform}from 'ol/proj'

import as controlfrom 'ol/control'

import as coordinatefrom 'ol/coordinate';

import {Modify, Snap}from 'ol/interaction'

import {Style, Stroke, Fill, Circleas StyleCircle}from "ol/style";

import {LineString, Polygon, MultiPolygon, Geometry, Point, LinearRing, Circle}from "ol/geom";

import {fromCircle as fromCirclePolygon, circular as circularPolygon}from 'ol/geom/Polygon';

import {Vectoras FeatureVector}from "ol/Feature"

import Tilefrom 'ol/layer/Tile'

import OSMfrom 'ol/source/OSM'

import {regionData}from 'element-china-area-data'

import Draw, {createBox, createRegularPolygon}from "ol/interaction/Draw";

一、加载在线地图
initMap() {

let raster =new Tile({

source:new OSM()

});

    let vector =new VectorLayer({

source:thissource,

    })

thismap =new Map({

layers: [raster, vector],

        target:'olMap',

        controls: controldefaults()extend([

new controlMousePosition({

coordinateFormat: coordinatecreateStringXY(4),

                projection:'EPSG:4326',

                target:this$refsmousePositionTxt

})

]),

        view:new View({

projection:'EPSG:4326',

            center: [114064839, 22548857],

            zoom:5,

        }),

    });

    /let circle4326 = circularPolygon([114064839, 22548857], 100000, 5000);

thissourceaddFeature(new Feature(circle4326));/

},

二,加载mapserver底图
initMap() {

let mapfile =thisglobalMAP_PATH +thisglobalBASEMAP_NAME;

    let url =thisglobalMAPSERVER_PATH;

    let wmsParam = {

map: mapfile,

        LAYERS:'ALL',

        transparent:true

    };

    let raster =new Tile({

source:new TileWMS({//切片WMS服务,多个标注

            url: url,

            params: wmsParam,

            serverType:'mapserver',    //服务器类型

            isBaseLayer:true

        })

});

    thismap =new Map({

layers: [raster],

        target:'olMap',

        controls: controldefaults()extend([

new controlMousePosition({

coordinateFormat: coordinatecreateStringXY(4),

                projection:'EPSG:4326',

                target:this$refsmousePositionTxt

})

]),

        view:new View({

projection:'EPSG:4326',

            center: [0, 0],

            zoom:1,

            extent:[ -180, -90, 180, 90]

}),

    });

},

你好,检查下
\Mirserver\Mir200\Envir\MapEventtxt
应该是这个文件出错了,如果没有,则按照地址创建一个空白的文本文件
MAPInfo这个是显示
正在加载地图数据
加载任务地图数据失败!!!才对
天互数据 为您解答,希望能帮到你

King_StdItems 是物品库
King_Monster 是怪物库
你这是什么版本呀,错误百出,你这个问题不是加载地图出错,而是脚本里要执行的内容在数据库里面找不到,加载时就出错了。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zz/10729864.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-10
下一篇 2023-05-10

发表评论

登录后才能评论

评论列表(0条)

保存