Openlayers Quick Query
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Component created
Component changed
Component body
OpenLayers Quick Query: Have you tried using geofield with openlayers_views and a map with 5000 nodes? No? I have and the result is: 280 MB, 2 min load time and all nodes are loaded into memory. But slow is not the entity_load, but the field_attach. With this short module and some custom code you can easily make your layers fast again:
Example
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;
}
}
For a complete example see openlayers_quick_query.api.php.
At the moment this will only work by applying a patch to OpenLayers:
http://drupalcode.org/sandbox/Fabianx/1540306.git/blob/master:/openlayer...
Explanation
With this little code OL quick query takes over for this map view and the render and field_attach for the data layer view are never called. Instead all processing is done directly via the supplied information.
Assumptions
* You have a geo field called field_geolocation in your content type.
Of course for other projections and maps other parameters might be needed and this really only supports wkt fields at the moment.
The attributes are the received fields and you need to use the whole name from the query for adding an attribute. The field should be present on the view.
As attributes supported are: nid, name, description and other OL attributes you want to set for each feature.
You might also consider using an ajax loading for the popup bubbles instead.
