Ushant Suman (21) [Avatar] Offline
#1
Hi,

I am trying to view a Postgis layer as WFS from geoserver and I have tried something like this:

source4 =new ol.source.Vector({
loader: function (extent) {
//place here any actions on start loading layer
document.getElementById('laodingcont').innerHTML = "<font color='orange'>start loading.....</font>";
$.ajax('http://localhost:8080/geoserver/NaturalEarth/wfs', {
type: 'GET',
data: {
service: 'WFS',
version: '1.0.0',
request: 'GetFeature',
typename: 'namespace:"NaturalEarth:Wells',
outputFormat: 'application/json',
srsname: 'EPSG:4326',
bbox: extent.join(',') + ',EPSG:4326'
},
success:function(response) {
format = new ol.format.GeoJSON(),
source4.addFeatures(format.readFeatures(response));
document.getElementById('laodingcont').innerHTML = "<font color='green'>finish loading vector layer.</font>";
}

})
},
strategy: ol.loadingstrategy.bbox
});



layer4 = new ol.layer.Vector({
source: source4,
name: 'WFS',
description: 'Test.',
visible: false,
style: new ol.style.Style({
stroke: new ol.style.Stroke({
color: 'rgba(0, 0, 255, 1.0)',
width: 2
})
})
});

But I am not able to see anything in the browser.please help.I am also not geeting any error in console.

regina.leo (254) [Avatar] Offline
#2
Unfortunately don't know answer to this. Might be better to ask on GIS stack exchange if you haven't already
Ushant Suman (21) [Avatar] Offline
#3
Ok no issues