Arguments and filters work currently by the logic within OpenLayers Data views - they grab arguments received by OpenLayers Map views and apply them to themselves, but exposed filters do not work without defining them in both places. This is obviously a bad thing, but also difficult to implement given the Views UI and the fact that OpenLayers Data views are full encapsulated. The most straighforward implementation is to have the OpenLayers Data views render their form elements, and then append these to the map object, which is passed to them by reference in render().

Comments

Adam S’s picture

This belongs in the Geocode issue queue (http://drupal.org/node/792560) however passing arguments is an Openlayers issue. I have installed the finder module http://drupal.org/project/finder. The Finder module will pass arguments (map/%/%) to the Openlayers view. However, I can't get the Openlayers view to validate without both arguments present in the URL.

How do I work with arguments in Openlayers?

I also started an issue with the Finder module http://drupal.org/node/789016

tmcw’s picture

I'm confused; isn't your code trying to do this in AHAH? So you're asking how to handle arguments when they aren't passed in the current URL? Or..?

Adam S’s picture

All that I am hoping for is an exposed autocomplete filter for a CCK text field in a block. Once the choices are made the page with the map view will be refreshed by hitting the apply button.

I can get the Finder module to call a page with the path of the Openlayers page view and with x number of arguments in the URL. Other than this the Finder module has nothing to do with the map.

I would love it if the normal Openlayer data and map views had an exposed filter for a CCK field that was autocomplete. I've read some places on drupal.org that people have done it. I just don't know how to code. This of course brings us to my first question that really belongs in the geocode module issue queue.

However, what if I was operating on a filter for a CCK text field independent of the geocode module (nothing to do with it) in an Openlayer view? And, I wanted that view to have an exposed autocomplete filter? Or a drop down list of taxonomy terms?

The problem now is if I pass one argument to the Openlayer view it works well, however, once there is two arguments it doesn't work like normal.

Adam S’s picture

Here is what I'm thinking about... http://www.tripadvisor.com/LocalMaps-g298484-d691623-Cafe_Pushkin-Area.html . I don't think that AHAH is needed. Even if the page has to be refreshed it's fine.

Imagine being able to use that map to locate the places that need medical supplies of different types and a layer mapping all know roads and supply lines in a devastated area like Haiti after the earthquake? Just an idea.

zzolo’s picture

Please keep in mind that OpenLayers does not (and will not) provide a way to do a geo query like a radius search or even a bounding box. This is for another module, IMO. Even having a CCK field is kind of out of the scope of this module.

But the core issue is that we need to be able to exposed filters (as provided by other modules) across the Views display and the Views data layer. Which you describe as well, but just wanted to make sure what we can provide.

tmcw’s picture

Component: Code » Documentation

I came across this issue today, and realized, after implementing the 'expected' solution halfway that one can just set the OpenLayers Data display to have a filter as a block, and then put that block on the page with the map, with Context or similar. So, this is becoming a documentation task rather than a code task - using existing code to do this is much better than pushing some new 'markup' or similar element into the OpenLayers module.

tmcw’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

seanberto’s picture

Quick point of clarification following up on comment #6, as far as I can tell, this works if the openlayers data display and the "page" view that contains the map preset are defined in the same view. This doesn't seem to work if the openlayers data display contains the exposed filter, but the page view that contains the map preset is in a separate view.

seanberto’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

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

R.J. Steinert’s picture

Er, yes, documentation issue. For those that don't know (me 5 seconds ago) to send your exposed filters to blocks you click on the Default display, and under "Basic Settings" you will find "Exposed form in block". Set that to yes. Then in your block admin you will find "Exposed form: {name of display}". Make sure to add descriptive names to those displays :).

seanberto’s picture

Bumping up against this again. The map that is the "container" holding the open layers preset is a separate view from the one that's generating the overlays. I've exposed the filter for the overlay view and have added it to the page view containing the map preset in a block. When I hit "submit" to apply the views filter, I'm taken back to the site homepage with the filters applied to the URL string. No bueno....

seanberto’s picture

mansspams’s picture

Also I opened issue for D7 + Views 3 for the same topic here #1273278: Add exposed filters in block option for OpenLayers Data Overlay

acbramley’s picture

I've tried this using exposed filters on both the Openlayers data view and the Openlayers Map view but haven't had any luck. Is it imperative to have the exposed filters in a block? Or can we just have views render them with the view? Also is ajax required etc?

acbramley’s picture

Ah got this working, just to reiterate previous points:

1) Openlayers Map AND data displays need to both be in the same view
2) The exposed filter needs to be exposed on both displays, using the map display to actually show the filter.

swfindlay’s picture

Version: 6.x-2.x-dev » 7.x-2.0-beta1
Component: Documentation » Miscellaneous
Category: task » support
Status: Closed (fixed) » Active

@acbramley I still can't get this to work (D7). Any chance you could write a quick idiot-proof step by step guide?

I'm trying to enable a user-search on nodes which will then show on a map. The search works ok - the nodes are returned in a table, but the map below doesn't show the nodes. And I get the error message: undefined index path in line 522 of /openlayers_proximity_handler_filter.inc (this line sets the "get_argument_options()") for each node.

I've tried lots of permutations but can't get any of them to work. Must be missing something simple...

Rob_Feature’s picture

#17 was key for me. You have to have the filter on BOTH displays (the open layers data and the map) or it won't work.....(now...how to recenter and zoom on the filtered data ;)

kokkytos’s picture

If you want to recenter and zoom on the filtered data check the option in Openlayer Map (under Behaviour) named Zoom to Layer.

Rob C’s picture

And tip:

  • Set filter on the page and the display. That should work.
  • Make sure all filters with the same value have the same name.
  • Expose the filters as a block. (got a couple people having succes, but not while the filter is not in a separate block)

+If you want to center + maintain other locations on the map, create multiple openlayers displays, 1 to display all items, 1 to zoom to layer, like #20 explains. See here for more info.

kiwimind’s picture

I'm still banging my head against this a little.

I'm trying to set up 3 layers of data, each with a different colour marker, using an exposed filter to only show one layer at a time. I have a page display and 3 openlayer data sections within my view.

When applying the exposed filter to only the page view, nothing happens, so as suggested in #17, I made sure that the existing filters that were being applied on the data views were exposed too. The reason that the data layers all had filters in the first place is so that, within openlayers, I can target them with the different markers.

The exposed filter is now applying cleanly, but the colours are now working incorrectly. I'm getting the first layer's coloured marker applied across all layers.

So it seems I can either have my layers coloured correctly OR have the filter work.

I don't think that adding in more layers as suggested in #21 is going to help, as I can get both sides of what I want working independant of each other, just not together.

If someone could give some guidance on how to make this work, that would be very much appreciated.

Thanks.

breezeweb’s picture

Just a note for other people trying to work with Exposed Filters and OpenLayers: recent versions of OpenLayers (up to and including 7.x-2.0-beta-7) have a significant bug that makes Exposed Filters totally non-functional. I spent hours banging my head against the wall on this, dutifully following the suggestions in this thread, thinking it was a problem with how the View was configured.

Here's the issue:
https://drupal.org/node/1993172

The good news is that it's fixed in recent -dev versions.

Hope that helps someone else!

  • tmcw committed 0a95fb5 on 7.x-3.1.x
    Adding OpenLayers Views layer, fixing [#789668]. Also renaming the admin...