I originally posted this in the Views GeoJson module issue queue, but the more I think about it, it seems like it would be more likely a core OL question.
Basically, I have a view outputting a GeoJson feed, I'm enabling that feed as a map overlay, then I'm displaying it in a separate view.
The problem comes up when I expose filters. Exposing filters on the map view doesn't change the geojson data and therefor the map is not updated. Exposing filters on the geojson view (I'm outputting it as a block) actually filters the content correctly but it takes me to the raw json output and doesn't display things on the map.
While I thought at first this was a problem with views geojson, that view is filtering 100% correctly. The problem is how the map is displayed and reacts to a change in the feed data.
Am I thinking of this the wrong way? I feel like I'm missing something simple but I'm definitely hitting a wall. Any help anyone can give me is much appreciated.
Comments
Comment #1
m.stentaCleaning up old issues. Views GeoJSON and Openlayers have changed drastically since this was posted. If you're still having this issue with the latest versions, please reopen!
Comment #2
jlsevillano CreditAttribution: jlsevillano commentedI followed this post to create a map with layer: http://www.petejwhite.com/drupal-views-with-openlayers-3-0-beta1/
But when i tried to make a filter to select some data with, for example Country, not runs...always display all items
GeoJSON 7.x.1.0-beta3+2-dev
Openlayers 7.x-3.1
Any solution?
Thanks
Comment #3
ekes CreditAttribution: ekes commentedAlso #2663964: How to make a map with exposed filters?.
And I'll add my use case we've got FacetAPI queries to add to the url, not views ones.
But in all cases you are calling the Views GeoJSON path which is set in the GeoJSON class options. It doesn't have any interaction with the URL (or specifically the $_GET) options of the page the map being displayed to user is on.
I've looked to see where I could inject the $_GET vars from the page into the request made in the OpenLayers JS, but there doesn't seem a point before the JS is made. It could be done in the Javascript['settings'], but that's really ugly. It's that or replace some of the js that openlayer supplies.
BUT I may well, actually probably have, overlooked a better way.
Comment #4
ekes CreditAttribution: ekes commentedMaybe better description.
Comment #5
ekes CreditAttribution: ekes as a volunteer commentedSo I can confirm the very hackish solution can work:-
Comment #6
jlsevillano CreditAttribution: jlsevillano commentedI'm going to try it, Thanks for all.
Comment #7
m.stenta