You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even if this question is over a year old, I am posting an answer for future reference (I wandered the same thing this week).
You can use it with OL3 with the code below. Just note that the updates of features won't work. It seems that OL3 only supports WFS-T 1.1.0 but TinyOWS only supports 1.0.0 (creation works though).
varformatWFS=newol.format.WFS({gmlFormat: newol.format.GML2({featureNS: 'http://www.tinyows.org/',featureType: [LAYER_NAME],srsName: EPSG,featurePrefix: 'test',}),});varformatGML=newol.format.GML2({featureNS: 'http://www.tinyows.org/',featureType: [LAYER_NAME],srsName: EPSG,featurePrefix: 'test',});varxs=newXMLSerializer();varsourceWFS=newol.source.Vector({loader: function(extent){$.ajax(WFS_SERVER,{type: 'GET',data: {service: 'WFS',version: '1.0.0',request: 'GetFeature',typename: LAYER_NAME,srsname: EPSG,bbox: `${extent.join(',')},${EPSG}`,}}).done(function(response){console.log(response);console.log(formatWFS.readFeatures(response))sourceWFS.addFeatures(formatWFS.readFeatures(response));});},strategy: ol.loadingstrategy.bbox,projection: EPSG,});varlayerWFS=newol.layer.Vector({source: sourceWFS});varinteraction;varinteractionSelectPointerMove=newol.interaction.Select({condition: ol.events.condition.pointerMove});varinteractionSelect=newol.interaction.Select({style: newol.style.Style({stroke: newol.style.Stroke({color: '#FF2828'})})});varinteractionSnap=newol.interaction.Snap({source: layerWFS.getSource()});varswissProjection=newol.proj.Projection({code: 'EPSG:2056',// The extent is used to determine zoom level 0. Recommended values for a// projection's validity extent can be found at https://epsg.io/.extent: [2485869.5728,1076443.1884,2837076.5648,1299941.7864],units: 'm'});ol.proj.addProjection(swissProjection);varmap=newol.Map({target: 'map',controls: [],interactions: [interactionSelectPointerMove,newol.interaction.MouseWheelZoom(),newol.interaction.DragPan()],layers: [newol.layer.Tile({source: newol.source.OSM({url: 'https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}.png',opaque: false,attributions: []})}),layerWFS],view: newol.View({center: [2647793.7,1216394.1],zoom: 0,projection: EPSG,extent: [2485869.5728,1076443.1884,2837076.5648,1299941.7864],})});
If you want to use WFS 1.1.0, you will have to change ol.format.GML2 into ol.format.GML:
varformatWFS=newol.format.WFS();varformatGML=newol.format.GML({featureNS: 'http://www.tinyows.org/',featureType: [LAYER_NAME],srsName: EPSG,featurePrefix: 'test',});varxs=newXMLSerializer();varsourceWFS=newol.source.Vector({loader: function(extent){$.ajax(WFS_SERVER,{type: 'GET',data: {service: 'WFS',version: '1.0.0',request: 'GetFeature',typename: LAYER_NAME,srsname: EPSG,bbox: `${extent.join(',')},${EPSG}`,}}).done(function(response){console.log(response);console.log(formatWFS.readFeatures(response))sourceWFS.addFeatures(formatWFS.readFeatures(response));});},strategy: ol.loadingstrategy.bbox,projection: EPSG,});varlayerWFS=newol.layer.Vector({source: sourceWFS});varswissProjection=newol.proj.Projection({code: 'EPSG:2056',// The extent is used to determine zoom level 0. Recommended values for a// projection's validity extent can be found at https://epsg.io/.extent: [2485869.5728,1076443.1884,2837076.5648,1299941.7864],units: 'm'});ol.proj.addProjection(swissProjection);varmap=newol.Map({target: 'map',controls: [],interactions: [interactionSelectPointerMove,newol.interaction.MouseWheelZoom(),newol.interaction.DragPan()],layers: [newol.layer.Tile({source: newol.source.OSM({url: 'https://cartodb-basemaps-{a-d}.global.ssl.fastly.net/dark_nolabels/{z}/{x}/{y}.png',opaque: false,attributions: []})}),layerWFS],view: newol.View({center: [2647793.7,1216394.1],zoom: 0,projection: EPSG,extent: [2485869.5728,1076443.1884,2837076.5648,1299941.7864],})});
Activity
Jenselme commentedon Feb 10, 2017
Even if this question is over a year old, I am posting an answer for future reference (I wandered the same thing this week).
You can use it with OL3 with the code below. Just note that the updates of features won't work. It seems that OL3 only supports WFS-T 1.1.0 but TinyOWS only supports 1.0.0 (creation works though).
If you want to use WFS 1.1.0, you will have to change
ol.format.GML2intool.format.GML: