Add notes/questions on the Fetch Vector Data section

Éric Lemoine
2013-08-21 08:21:52 -07:00
parent baf3d06f57
commit 4dfc6bee8d

@@ -22,6 +22,37 @@ var layer = new ol.layer.Vector({
For data that is already available in memory as string or object, a `data` option can be provided instead of `url`.
Notes and questions from @elemoine:
So ol.layer.Vector works with a fixed strategy, an HTTP protocol, and a GeoJSON format (using ol2 terms here). What would the API look like if what I want to use is a fixed strategy and, say, a WFS protocol?
What do we fix in a source type? The strategy? The protocol? Both? I think I would fix the strategy, and get rid of strategies entirely in ol3.
So:
```js
var layer = new ol.layer.Vector({
style: myStyle,
source: new ol.source.VectorFixed({
protocol: new ol.protocol.WFS({
url: 'http://example.com/data',
parser: new ol.parser.GeoJSON()
})
})
});
```
For Fixed/HTTP/GeoJSON, Fixed/HTTP/TopoJSON, and Fixed/HTTP/KML we can certainly provide convenience classes: ol.source.GeoJSON, ol.source.TopoJSON, and ol.source.KML. E.g.
```js
var layer = new ol.layer.Vector({
style: myStyle,
source: new ol.source.GeoJSON({
url: 'http://example.com/data'
})
});
```
## Style Vector Data
Initially, we can style data with a subset of CartoCSS or SLD, without exposing a style API.