uniapp 整合 OpenLayers - 加载 arcgis server 图层

1、加载mapserver服务







2.加载wms服务

import TileLayer from 'ol/layer/Tile.js'// OpenLayers的瓦片图层类 
import TileWMS from 'ol/source/TileWMS.js';

***

//url为wms服务地址
var lyr = new TileLayer ({
            source:new TileWMS({
                params:{'LAYERS':'0'},
                projection:"EPSG:4326",
                url:url
            })
    });

3.加载wfs服务

import VectorLayer from 'ol/layer/Vector.js';
import VectorSource from 'ol/source/Vector.js';
import * as olLoadingstrategy from 'ol/loadingstrategy';
import WFS from 'ol/format/WFS.js';
import GML2 from 'ol/format/GML2.js';
import Style from 'ol/style/Style.js';

***

lyr = new VectorLayer ({
        source:new VectorSource({
                strategy:olLoadingstrategy.bbox,
                url:function(extent){
                        return 'https://localhost:6443/arcgis/services/a_river/mapserver/wfsserver?service=wfs&version=1.1.0&request=getfeature&typename=highway&outputFormat=gml2&EPSG:4326&bbox=' + extent.join(',');
                        },
                format:new WFS({
                        gmlFormat:new GML2({
                        srsName:'EPSG:4326',
        featureNS:'http://localhost:6080/arcgis/services/highway/MapServer/WFSServer',
                        featureType:'highway'
                        })
                })
            }),
                style:new Style({...})

4.加载瓦片服务

import TileLayer from 'ol/layer/Tile.js'// OpenLayers的瓦片图层类   
import XYZ from 'ol/source/XYZ.js'

***

//url为mapserver服务地址,z为瓦片级数
var lyr = new TileLayer({
        source:new XYZ({
            url:url + '/tile/{z}/{y}/{x}'
        })
 });

你可能感兴趣的:(uni-app,arcgis,swift)