I read a book about OpenLayers 3 and I guess its about an older OpenLayers version because it mentions a ol.source.ServerVector
vector source for getting WFS layers from a server.
In the latest OpenLayers 3.9.0 that I use, when I search the API the only vector sources I can find are vector, cluster, tileVector and imageVector.
So my first question is, is ol.source.ServerVector
deprecated? Should I use plain ol.source.Vector
instead to fetch WFS features from my GeoServer service?
When I search "WFS" on the OL examples I get only one example that uses ol.source.Vector
to get WFS from GeoServer.
My second question is about the settings.
I don't get what this does url: function(extent, resolution, projection) {
, how the URL is implemented and what the strategy
exactly does. Can somebody explain or provide links to tutorials?
Best Answer
About your first question ol.source.ServerVector is deprecated and yes you may use ol.source.Vector instead. For you second question, you may read some info about the
url
here here. I use theloader
function instead of url so I am not familiar to explain more about theurl
.Now about the
startegy
. This is indicating which features to load. This could be:ol.loadingstrategy.bbox
means will only load features exist within you current map MBR.ol.loadingstrategy.all
means all features will be loaded in a single requestol.loadingstrategy.tile
means loading features based on a tile grid.(you may find some info for strategies here)
This is an example of a wfs layer that may give you some idea (I am using the
loader
function)