Use-Cases update
+39
@@ -86,6 +86,45 @@ vector.addFeatures(parser, {
|
|||||||
|
|
||||||
In this alternative, the vector layer has no source set - meaning the user will be manually generating features. This alternative can be implemented if the layer knows about the map projection. In the `addFeatures` method, the layer calls `parser.readFeatures(data, {projection: projection})` where `data` is the first argument to `addFeatures` and `projection` is the map view's projection.
|
In this alternative, the vector layer has no source set - meaning the user will be manually generating features. This alternative can be implemented if the layer knows about the map projection. In the `addFeatures` method, the layer calls `parser.readFeatures(data, {projection: projection})` where `data` is the first argument to `addFeatures` and `projection` is the map view's projection.
|
||||||
|
|
||||||
|
_Questions/comments from Eric:_
|
||||||
|
|
||||||
|
In my alternative, and based on my comments for the previous use-case, the app would add features to the store.
|
||||||
|
|
||||||
|
** Alternative 2**
|
||||||
|
|
||||||
|
var vector = new ol.layer.Vector({
|
||||||
|
source: new ol.source.Vector({
|
||||||
|
projection: 'EPSG:4326'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
var map = new ol.Map({
|
||||||
|
target: 'map',
|
||||||
|
layers: [vector]
|
||||||
|
view: new ol.View2D({
|
||||||
|
projection: 'EPSG:1234',
|
||||||
|
center: ol.projection.transform(
|
||||||
|
new ol.Coordinate(-111, 45), 'EPSG:4326', 'EPSG:1234'),
|
||||||
|
zoom: 3
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
var parser = new ol.parser.GeoJSON();
|
||||||
|
|
||||||
|
vector.getSource().addFeatures(parser, {
|
||||||
|
type: 'FeatureCollection',
|
||||||
|
features: [{
|
||||||
|
type: 'Feature',
|
||||||
|
geometry: {
|
||||||
|
type: 'Point',
|
||||||
|
coordinates: [-111, 45]
|
||||||
|
},
|
||||||
|
properties: {
|
||||||
|
foo: 'bar'
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
|
||||||
### Load data based on map extent
|
### Load data based on map extent
|
||||||
|
|
||||||
User has a service that provides vector features for requests with an arbitrary BBOX (e.g. a WFS). Data source contains hundreds of millions of features with worldwide coverage (e.g. OSM) and the user only wants to display a small subset, updating rendered features as the user navigates around the map.
|
User has a service that provides vector features for requests with an arbitrary BBOX (e.g. a WFS). Data source contains hundreds of millions of features with worldwide coverage (e.g. OSM) and the user only wants to display a small subset, updating rendered features as the user navigates around the map.
|
||||||
|
|||||||
Reference in New Issue
Block a user