Display multipolygon and center point unclustered

Created on 8 November 2023, about 1 year ago
Updated 19 December 2023, about 1 year ago

Problem/Motivation

I have a node bundle that represents properties.
It contains:

  • a field that stores the perimeter of the property as a multipolygon
  • a field that stores the center of the property as a point

I am able to display both the outline of the property and the icon at the center. However, with clustering enabled the center and outline are treated as two separate properties that get clustered together.


Proposed resolution

I see two ways to resolve this issue:

  • Allow providing a center point for polygons
  • Add cluster configuration to consider multiple points as the same entity
💬 Support request
Status

Closed: outdated

Version

10.2

Component

Code

Created by

🇺🇸United States jayhuskins

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @jayhuskins
  • Status changed to Needs review about 1 year ago
  • 🇮🇹Italy itamair

    Not clear how you would like them to cluster once they are close to others geometries that are not meant to be part of the same entity.
    Should the Points not cluster with the Geometries that are part of the same entity/node, but cluster with other Points of other entities/nodes? ... and what about other Geometries of other entities/nodes?

    You should also clarify (first to yourself ... if not yet done) which is the logics you want to implement for clustering in all those combinations,
    and hence try to leverage all the tools that the Leaflet module already provides you, such the following:

    - the Leaflet View style configuration allow to select an Exclude Flag that support Replacements Tokens (so you could add that boolean to your entity/node dat model / fields and use it in the Marker Clustering configuration;
    - the Leaflet View style configuration allow to enable / disable Marker Clustering of Paths / Geometries;
    - take advantage of existing Leaflet Views hooks, documented in the leaflet_views.api.php, so to eventually alter the Exclude Flag during the pre-processing JS phase, so to make the Exclude Flag true or false according to your specific logics (in case of Point or Geometry, etc.);
    - rather then using 2 different geofield fields, seriously consider the better option to adopt an approach with 2 Paragraphs types/bundles, entity referenced from a single field, with a common (re-used) Geofield field, but configured differently (one allowing just Points and the other just Polygons), and adding into both Paragraphs a boolean field such as "Exclude from Clustering" that might be selectively set for each paragraph (geo - component) and then drive as Replacement Token the "Exclude Flag" Leaflet View style configuration mentioned above ...
    -. last but not least you could even override with your customised / extended one the "Drupal.Leaflet.prototype.add_features" method implemented in the Drupal.Leaflet.prototype.add_features ...

    Hope all the above could make sense and be helpful to you.
    Does it sounds confusing and pretty complicate?

    Well this Support issue of you is not the most clear and easy one, also ;-)

  • Status changed to Closed: outdated about 1 year ago
Production build 0.71.5 2024