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.
Comments
Comment #1
jeffschulerAs a patch...
Comment #2
zzolo commentedOk, 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?
Comment #3
jeffschulerWorking for me, with further changes to Views GeoJSON.
Thanks!
Comment #4
jeffschuler