通过wfs方式向后台geoserver请求矢量数据,然后在前端通过vectorlayer展示出来,增强交互效果。
function getParkingLayerFunc(mapUrl,parkingLayerName){
//获取该坐标系下地图边界
var projectionExtent = ****.projection.getExtent();
var namespace = ****.mapSpace;
//wfs请求获取矢量图层gml数据信息
****.vectorSource = new ol.source.Vector({
loader : function(resolution, projection) {
var dataUrl = mapUrl+'/geoserver/wfs?'
+ 'service=WFS&request=GetFeature&'
+ 'version=1.1.0&typename='
+namespace
+ ':'
+ parkingLayerName;
$.ajax({
url : dataUrl
}).done(function(response) {
var format = new ol.format.WFS({
featureNS : 'http://www.'+namespace+'.com',
featureType : parkingLayerName
});
var features = format.readFeatures(response,
{featureProjection: projection}
);
****.vectorSource.addFeatures(features);
});
},
strategy: ol.loadi

最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



