I have a OpenLayers map that is Views powered. It is displaying a custom entity type that, at current, has 512 records.

They are all geocoded properly.

What I would like to do next is provide a filter enabled map view (just 2 or 3 Fields) that updates on change via Views AJAX setting. I'd also like the pin pop ups to use a view mode of my choosing. I've found that, even with 50 results, the map can load fairly slow.

Are there any best practices for a very snappy map / interaction experience? What can I strip away to make it as fast as possible? Is there a way to create my own page/form and send requests with JSON?


jeisses’s picture

I had performance issues as well, this sandbox fixed them for me: http://drupal.org/sandbox/Fabianx/1540306

Using OpenLayer Quick Query I can load 2000+ items using 12 exposed filters very fast using Views AJAX.

mellowtothemax’s picture

@ jeisses


could you possibly explain how you setup the module mentioned, as I am having problems configuring it to work.

I am urgently need it for a site I have with over 10000 nodes geocoded and it takes over 1m 30 to load the map.


jeisses’s picture


sure, this is how I set it up:
1) Install module
2) Apply the patch included in the module to the OL module (it's small patch, I applied it by hand).
3) In you module, implement hook_openlayers_quick_query_info(), from the projects page:

function hook_openlayers_quick_query_info($view) {
  if ($view->name == 'my_map') {

    // Add projection and wkt information
    $info['projection'] = '4326';
    $info['wkt_field'] = 'field_geolocation';

    // Add needed fields
    $info['fields'][] = array(
      'field_name' => 'field_geolocation'

     $info['attributes'] = array(
      'nid' => 'nid',
      'name' => 'node_link_fast', // Special very fast node_link linking the title using just node/<nid> with no aliases

    return $info;

field_geolocation must be geo field of your node, the $info['attributes'] are attributes to the vector in OL (e.g. for info in popup).

I decided for speed to load popups with AJAX, so I only used 'nid' as attribute.

mErilainen’s picture

I tried the same as above, but cannot get anything out.

"I decided for speed to load popups with AJAX", any instructions how to do this? Custom code?

So would that custom hook basically override any fields you have added in the view itself? What about other stuff like other displays which I'm using for different layers on the same map etc? How do you provide a title for the popup? (I assume it has something to do with that "node_link_fast" value in the array)

namwebs’s picture


@jeisses: Could you elaborate on point 3 - where does this code have to go? What is the 'projects page' that you mention?