fetch('geoserver/gzzjygis/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=layername&maxFeatures=100000&outputFormat=application%2Fjson', {
method: 'GET',
}).then(function(response) {
return response.json();
}).then(function(json) {
var features = new GeoJSON().readFeatures(json);
var testLayer = new VectorLayer({
source: new VectorSource({
features
}),
style: function(feature) {
var value=feature.getProperties().price;
if(value>1000|| value<200){
return new Style({
image: new CircleStyle({
radius: 5,
fill: new Fill({color: `rgba(255,0,0,0.7)`}),
//stroke: new Stroke({color: '#bada55', width: 1})
})
});
}
return new Style({
image: new CircleStyle({
radius: 2,
fill: new Fill({color: `rgba(100,100,100,0.4)`}),
//stroke: new Stroke({color: '#bada55', width: 1})
})
});
}
});
map.addLayer(testLayer);
});