i was looking for a way to add the cluster information to data provided by leaflet_views.

leaflet prepares the data gathered from views using leaflet_process_geofield before it sends it further to be processed in leaflet.drupal.js.

the attached patch adds a hook_leaflet_views_alter_points_data which i currently use in a working draft of my geocluster module.

in order to visualize clusters as numbered markers, i currently rely on a adapting Drupal.leaflet.create_point.

i'd be happy to hear your thoughts on my approach to clustering and the related leaflet integration.
also see #1547610: Plan server-side geo clustering for drupal 7

Comments

dasjo’s picture

here's a screenshot of how it looks like:

geocluster_leaflet_preview2.png

pvhee’s picture

Status: Needs review » Needs work

Nice work dasjo, I'd like to add this to the module but could you also provide a patch for the API docs?

dasjo’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes

here's an updated patch that uses drupal_alter and provides API docs.

i'm not in a hurry though, as for geocluster i'm relying mostly on views_geojson with its own, similar hook #1799870: Add hook views_geojson_feature_alter

rdeboer’s picture

Thanks for the patch. Great idea.

But Patch broken: 0 bytes.

dasjo’s picture

StatusFileSize
new1.33 KB

ups, here it is :)

rdeboer’s picture

Thanks! -- Rik

pvhee’s picture

Status: Needs review » Fixed

Thanks dasjo, this looks good, and I've committed it.

Status: Fixed » Closed (fixed)

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

aaronbauman’s picture

Status: Closed (fixed) » Needs review
StatusFileSize
new651 bytes

The API function is leaflet_views_alter_points_data_alter(), not leaflet_views_alter_points_data().

rdeboer’s picture

Status: Needs review » Fixed

Patch applied with attribution.
Thanks Aaron!
Rik

Status: Fixed » Closed (fixed)

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