We have a contacts database with 20.000 contacts in it. They will be geocoded with geocoder.

I'd like to show those contacts on map. They are on the whole Belgium area (to give you an idea).

Is it possible to cluster them, or load them based on a viewport? I could ask users to first enter city or postal code to center the map on a particular area, and only show the contacts in this area.

Can this be done with openlayers?

Thanks in advance

Comments

zzolo’s picture

Hey @philippejadin.

There is client side clustering in this module as provided by the OL library. But, its not very robust, and you will still run into problems client-side with that much data.

There is no integration with bounding box and live pull from Views. This is slowly in the works, integrating with the views_geojson module, as this is the most natural way to do this in the OL library.

But, overall, the API for this module is fairly robust enough for you to make this happen with custom code.

philippejadin’s picture

Thank you for this anwer.

Would you think that using only openlayers + a custom sql query on the database would be simple and to the point?

I fear that the stack of views + geojson + geojson view + custom glue code would be unnecessary and very slow for each map move by the end user.

A single sql query can return the nodes in a specific bounding box area with their ID and titles, this is much simplier imho.

nod_’s picture

If you have something working, by all means have a look at #1360260: Add views filter to provide proximity search of Geofields :)

kloewer’s picture

We are having about the same issue of displaying 1.500 Entries on a map.

How did you fix this?

dasjo’s picture

ifrik’s picture

Using postcodes: Depending on how large the area of a postcode is, you could filter on the postcode and only display nodes that have the same postcode. The same goes for additional regions (e.g. provinces, councils - depending on the existing administrative borders). That would reduce the number of nodes to be displayed, which could then be clustered (using your map's behaviour settings).
If the postcodes cover only small areas you could check whether this support request has helpful ideas: https://drupal.org/node/1735210

From a user point of you: I suppose the users will never actually use a map that displays all 20.000 nodes anyway so maybe it is more useful anyway to start on a more focused map?

batje’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

The proposed solutions should give you a way forward:

Client side clustering
Server side clustering
Filtering the results

Or, of course, combinations of these.