From 8aab66ff77a3a41209b8629b70cce183533c6e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Wed, 27 Mar 2013 15:51:54 +0100 Subject: [PATCH] Use-Cases update --- Use-Cases.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Use-Cases.md b/Use-Cases.md index 5600085..9d5a41a 100644 --- a/Use-Cases.md +++ b/Use-Cases.md @@ -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. +_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 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.