Closed (fixed)
Project:
Openlayers
Version:
6.x-2.0-alpha10
Component:
OpenLayers Views
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Anonymous (not verified)
Created:
28 Jan 2011 at 06:36 UTC
Updated:
16 May 2024 at 00:51 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
tmcw commentedYou could use OpenLayers CCK displays for this purpose.
Comment #2
Anonymous (not verified) commentedI actually worked out how to do this myself just now. Here's my setup:
I have my existing page view setup with normal filters and exposed filters. I have set the exposed filters form to display in a block.
I then added an attachment display to my view (not attached to anything), which was the same as the page display, but with the following changes:
- The only field it outputs is the Node ID
- The exposed filters were changed to arguments (normal filters stayed the same) - to do this, I had to use the Views patch from here to allow the arguments to use the 'contains' operator (the same as my exposed filters)
This attachment display allowed me to get the NIDs of the nodes returned when doing a search on the page display. I simply got the page displays search terms from the URL using $_GET[], then passed those terms as arguments to the attachment display to get a list of NIDs.
This code was placed in a filter (using ViewsPHPFilter) in an OpenLayers Data display so that the OpenLayers map would show the same nodes returned in the page display (this was the only filter used in the OpenLayers Data display). The fields output by the OpenLayers Data display were simply the ones I wanted displayed in the map popup boxes (plus the WKT field).
Finally, I added a block display which displayed a map based on the OpenLayers Data display, then placed this block in the sidebar on the page displays URL.
Now, when I search for nodes using my page displays exposed filters, I see the nodes on the page itself, as well as on a map in the sidebar. Awesome!
I've attached my view for anyone interested in doing something similar.
Comment #3
Devcal commentedGreat!!!! , I want to do exactly the same thing. But I do not understand everything (my poor English), it is possible to have screenshot of your attachment display's configuration? and openlayers Data display's configuration?
I have long sought
thanks
Comment #5
Anonymous (not verified) commentedHere you go.
Comment #6
kapayne commentedMany thanks to all the good advice here, especially the good comments from BWPanda.
In case anyone else is looking through here I'd like to document an alternative solution that might come in handy.
In the case presented in #2 the developer used exposed filters to return a list of nodes on a page. The same terms from the exposed filter were in the URL so the developer grabbed the terms from the url using the GET command and passed them into arguments in the attachment display, essentially running the filter twice, one in the page and once in the attachement display. The attachemnent display returned the NIDs from the second filter and the phpfilter grabbed the nids from the attachment display to openlayers.
Alternatively, I set up a set of exposed filters on a page and in that same view, I grabbed the resulting nids from the filter and put them in a session variable in the footer (global text area). Then I used the php filter in the open layers data view to get the nids from the session.
The footer on the page display:
This is the phpfilter on the open layers data display:
return explode(",", $_SESSION['nid']);
Comment #7
rob70 commentedKapayne, BWPanda, I require something similar, with the added issue of needing to page the nodes to do slow performance in IE.
How many nodes can your solution display at a time efficiently?
Thanks to you both for the walkthroughs on these solutions!