openlayer3 系列 2 – 加载 arcgis server 图层

1.ol加载mapserver服务

// url为MapServer服务地址
var lyr = new ol.layer.Tile({
            source:new ol.source.TileArcGISRest({
                projection:'EPSG:4326',
                url:url
            })
    });

2.加载wms服务


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

3.加载wfs服务

lyr = new ol.layer.Vector({
        source:new ol.source.Vector({
                strategy:ol.loadingstrategy.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 ol.format.WFS({
                        gmlFormat:new ol.format.GML2({
                        srsName:'EPSG:4326',
        featureNS:'http://localhost:6080/arcgis/services/highway/MapServer/WFSServer',
                        featureType:'highway'
                        })
                })
            }),
                style:new ol.style.Style({...})

也可以先查询之后加载,类似于arcgis 中的graphicsLayer

4.加载瓦片服务

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

 

将不定期更新资源,欢迎持续关注


想获得更多的学习知识请关注微信公众号:西北码农或扫下方二维码

 

转载自:https://blog.csdn.net/bitree1/article/details/80755803

You may also like...