Leaflet views country outlines with entities grouped per country

Created on 8 October 2019, about 5 years ago
Updated 19 March 2024, 9 months ago

Hi Tanc!

This is a feature request that may or may not belong in this module, so I'd love to hear your thoughts to ensure that efforts can be combined if appropriate.

We would like to make use of the country overlay that the leaflet_countries module provides to display a list of a number of entities that have geolocation within a given country. The popup will trigger on hover or click and list a title and description for each, or perhaps rendered teasers or another specific display mode, with multiple entities being listed in the single country popup linking through to the entities themselves.

Here are a few considerations that I've thought of so far:

Source field of the country data

The leaflet_countries module currently stores the country data in a special field type, and does not support geofield or address fields. I can see this makes sense as we just need the country, not a geolocation point. In our case, the entities already have address fields and a geofiled and geocodes from the address field, so adding another field is probably duplicating data.

The leaflet module now depends on geofield and has hidden the leaflet and leaflet_attachment views styles from the views UI #3018502 , these are the views which leaflet_countries currently relies on.

We could perhaps extend the leaflet_countries module to support multiple options for the geolocation source: the field provided by leaflet_countries, address field with a country, and geofield. If supporting geofield, this may involve a lookup to confirm which country a given lat / long point is in.

Views style and row plugins

Firstly, should leaflet_countries continue to rely on the views in leaflet module that are now hidden from the UI?
If not, should we move those views plugins into the leaflet_countries module? That would then mean maintaining those views here. Architecturally this would then deveate from the leaflet module's leaflet_views sub module, still having a 'leaflet' base view with a 'leaflet_attachment' attachment view to display the data with a views row plugin. I'm not sure what the advantages of having the views attachment are. The leaflet module appears to perform all of the views processing in a single views style plugin with no row separate plugins. Are there other advantages of using attachment views such as building up several layers of leaflet overlays?

Another approach might be to evolve the leaflet_views module to take the leaflet_map views style and refactor it to use views row plugins, allowing the option for users to chose a views row plugin for points on the map or a row plugin for country outlines.

Grouping

Next I'd like to think about the ability to group entities into a list of teasers or titles to be displayed in the popup. I've not investigated how to support this yet, is it as simple as setting usesGrouping to TRUE? I suspect there might be more to it, certainly theme consideration and what to do with large numbers of results.

Do you have any immediate thoughts or suggestions on which approach might be best for the longevity of relationship between leaflet_countries and the leaflet / leaflet_views modules or otherwise?

Many thanks,

Finn

Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom Finn Lewis

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024