Community

How to make a filterable map via OpenLayers/Views?

Hi!

We are in process of converting our site over to Drupal (6.2.8 for now) from a static/custom jsp site. Last year, we had a dynamic map (see here: http://archive.summer.harvard.edu/help/directions.jsp )

Key behavior was that when you selected something from one dropdown the other filtered itself to show 'legal' values, and immediately updated the map to show the selected building. Directions were a plus, but those are not planned for the Drupal version.

My data/view is structured like so: I have a building content type which contains building name, type, lat/lng, and location data. I have two openlayers views - one for the map data, which accepts a nid as the argument and filters against the building node, and has exposed filters for type and name. Another is the map view itself which is set to use 'exposed filter in block' and accepts a nid as the argument.

I've been able to get pretty close using OpenLayers and views, but I have found some stumbling blocks along the way. Specifically, if I use exposed filters for my type and building dropdowns, I need to submit the form and reload the page in order to refresh the map.

I was really hoping that I'd be able to maintain the ajaxy behavior from the old map in the transition to Drupal. So I've thought of some options, but none are working great yet:

- Since the map view itself takes a nid argument, maybe I don't need a filter at all. What if I made a different view that just had select inputs in it, each of which had some kind of onselect that sent the nid to the map? (I could build them w/ jquery UI autocompletes using a view as a json datasource, for instance)

- Maybe there's some kind of way to use panels to pass arguments between views? (But can it do it dynamically without reloading the page?)

- Am I just going about this all wrong, should I go back to custom-coding my map clientside?

Comments

_

First, you should really reconsider creating a new drupal site using d6 which will see it's end-of-life. Having said that however, you can add ajax behavior to a view through the 'advanced settings' fieldset though I think exposed form ajax was added with the d7 version.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

I'm using ajax views to

I'm using ajax views to render a view + attachement and it works fine in Drupal 7. I did have to expose my filters + expose them in a block (not the view itself) and i had to set a title for the exposed filter. (and that has to be the same for the page/block and openlayers data overlay.

And i agree, go D7, end-of-life for D6 is getting closer and closer + active contrib module development is on D7. (mostly)

See here for an example.

That site is made with:

  • Openlayers
  • Geofield and geophp
  • Views
  • Core block system
  • Core taxonomy system
  • Core node system

Believe me, I'm working

Believe me, I'm working aggressively to move our sites to D7, but we have a tremendous institutional investment in D6 and I do not have the option of moving this particular site to D7 within our timeline. In this case I suspect I'll end up writing my own filters in jqueryUI autocompletes and go for a 'real' solution through views on next year's D7 version...

Yes Rob, that is more or less

Yes Rob, that is more or less exactly what I want to do. Perhaps D6's ajax routines just aren't sufficient in this case :/

If you want to do ajax, then

If you want to do ajax, then D7 almost is a must. D6 does supports it, but in D7 the support for ajax has improved so much.

At this time projects are in development that offer a way to set up a complete ajax site, so we'r not done yet, but we already have a stack in D7 that offers lots more then D6 will ever support.

If you are already working towards D7, then i would really stress the benefits, including views, entity, media, etc, etc, but if your out of time, then yeah, custom code seems like the way to go in your case.

nobody click here