javascript - OpenLayers 3 WFS not visible -
i want display wfs layer (in gml format) on openstreetmap using openlayers 3.5.0. link of extrernal wfs layer: http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/batimetrica.map&service=wfs&version=1.0.0&request=getfeature&typename=el.batimetrica.&srsname=epsg:4326
the way using follows:
sourcevector = new ol.source.vector({ loader: function(extent) { $.ajax('http://wms.pcn.minambiente.it/ogc?map=/ms_ogc/wfs/batimetrica.map',{ type: 'get', data: { service: 'wfs', version: '1.0.0', request: 'getfeature', typename: 'el.batimetrica.', srsname: 'epsg:4326' }, }).done(loadfeatures); }, strategy: ol.loadingstrategy.tile(new ol.tilegrid.xyz({ maxzoom: 19 })), }); window.loadfeatures = function(response) { formatwfs = new ol.format.wfs(), sourcevector.addfeatures(formatwfs.readfeatures(response, {dataprojection: ol.proj.projection('epsg:4326'), featureprojection: ol.proj.projection('epsg:3857')})); }; layervector = new ol.layer.vector({ source: sourcevector, style: new ol.style.style({ stroke: new ol.style.stroke({ color: 'rgba(0, 0, 255, 1.0)', width: 2 }) }) });
i can see on network tab of inspector receive features not displayed. features in projection epsg:4326. know osm in epsg:3857. think reason cannot display because of difference. think reason 1 , can suggest solution me? thanks!
Comments
Post a Comment