Started at #1370448: Provide GeoJSON Layers from Views (integrating with views_geojson)

@jeffschuler's code:

This diff is against OL + patch in #16:
diff --git a/plugins/layer_types/openlayers_layer_type_geojson.js b/plugins/layer_types/openlayers_layer_type_geojson.js
index a2eb38e..f9750cf 100644
--- a/plugins/layer_types/openlayers_layer_type_geojson.js
+++ b/plugins/layer_types/openlayers_layer_type_geojson.js
@@ -12,7 +12,6 @@ Drupal.openlayers.layer.geojson = function(title, map, options) {
   var features = null;
   options.projection = 'EPSG:' + options.projection;
   options.styleMap = Drupal.openlayers.getStyleMap(map, options.drupalID);
-  var layer = new OpenLayers.Layer.Vector(title, options);
   // GeoJSON Projection handling
   var geojson_options = {
@@ -20,6 +19,15 @@ Drupal.openlayers.layer.geojson = function(title, map, options) {
     'externalProjection': new OpenLayers.Projection(options.projection)
   };
+  // Use BBOX strategy.
+  options.strategies = [ new OpenLayers.Strategy.BBOX() ];
+  options.protocol = new OpenLayers.Protocol.HTTP({
+    url: options.url,
+    format: new OpenLayers.Format.GeoJSON(geojson_options),
+  });
+
+  var layer = new OpenLayers.Layer.Vector(title, options);
+
   // If GeoJSON data is provided with the layer, use that
   if (options.geojson_data) {
     // Read data in.
Files: 
CommentFileSizeAuthor
#1 openlayers-bbox-1493344-1.patch1.17 KBjeffschuler
PASSED: [[SimpleTest]]: [MySQL] 236 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new1.17 KB
PASSED: [[SimpleTest]]: [MySQL] 236 pass(es).
[ View ]

As a patch...

Status:Needs review» Active

Ok, so I spruced it all up and committed it:
http://drupalcode.org/project/openlayers.git/commit/b1a7b56

I had to hack up the Views GeoJSON module to get things working. https://drupal.org/node/1333324#comment-5763468

Can you all try it out and let me know how it works for you?

Working for me, with further changes to Views GeoJSON.
Thanks!

Status:Active» Fixed

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.