I'm try to display my points set from Geoserver in Openlayers map. I want to use WFS service, but at the moment I see one point, additionally in wrong place! I want to display all at EPSG 4326. I transformed map to this coordinate system and my points on Geoserver (imported from PostGIS database) are at EPSG 4326. I use Geoserver 2.15.1.
My code:
var wfs = new ol.layer.Vector({
source: new ol.source.Vector({
loader: function (extent) {
$.ajax('http://localhost:8080/geoserver/pilgrimages/ows', {
type: 'GET',
data: {
service: 'WFS',
version: '1.1.0',
request: 'GetFeature',
typename: 'travels',
srsname: 'EPSG:4326',
outputFormat: 'application/json',
bbox: extent.join(',') + ',EPSG:4326'
}
}).done(function (response) {
wfs
.getSource()
.addFeatures(new ol.format.GeoJSON()
.readFeatures(response));
});
},
strategy: ol.loadingstrategy.bbox,
projection: 'EPSG:4326'
})
});
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
wfs
],
view: new ol.View({
center: ol.proj.transform([0,0], 'EPSG:4326', 'EPSG:3857'),
zoom: 6
})
});
Can you help me?
readFeatures