Minimal vector API write-up, based on https://groups.google.com/d/msg/ol3-dev/qxVhm8DjcBM/cmhyznJb_34J
@@ -0,0 +1,33 @@
|
|||||||
|
## Goals
|
||||||
|
|
||||||
|
* provide a way to fetch vector data from multiple sources, in multiple formats
|
||||||
|
* provide a way to style the data for rendering
|
||||||
|
* provide a way to edit the data
|
||||||
|
* provide a way to persist edits
|
||||||
|
|
||||||
|
## Fetch Vector Data
|
||||||
|
|
||||||
|
The vector source can fetch data and persist edits (like the protocol in OpenLayers 2). HTTP can be the default, and there can be other vector sources (e.g. WFS). We can start with a default fixed strategy, and later we can add more strategies. So the minimal API for fetching vector data could look like this:
|
||||||
|
|
||||||
|
```js
|
||||||
|
var layer = new ol.layer.Vector({
|
||||||
|
style: myStyle,
|
||||||
|
source: new ol.source.Vector({
|
||||||
|
url: 'http://example.com/data',
|
||||||
|
projection: 'remote-proj', // this will typically come with the data
|
||||||
|
parser: new ol.parser.GeoJSON(),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Style Vector Data
|
||||||
|
|
||||||
|
Initially, we can style data with a subset of CartoCSS or SLD, without exposing a style API.
|
||||||
|
|
||||||
|
## Edit Vector Data
|
||||||
|
|
||||||
|
Features can already be accessed with ol.Map#getFeatures. #850 adds event handling for added and removed features, so the renderer can keep the view up to date. The CHANGE event could also be used to keep track of feature modifications, but it imposes significant overhead to register a change listener on every single feature. So preferably, the feature modification workflow will be provided by controls that move features to a sketch layer for editing and register CHANGE listeners for these features only. After editing, the sketch features can be moved back to their original layer. This workflow can also be used for attribute modifications.
|
||||||
|
|
||||||
|
## Persist Edits
|
||||||
|
|
||||||
|
The layer source can also provide a way to save changes for protocols that support CRUD.
|
||||||
Reference in New Issue
Block a user