• pedrogatto

    (@pedrogatto)


    Hi,
    Is there a way to create different layer controls grouped? Example of geojson:
    Properties:
    Restaurant: French, Italian, American…
    Food: Pasta, Pizza, Meat…

    I would like to have a box on the toplight where people can filter markers choosing for example all French restaurants that have Meat.

    thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor hupe13

    (@hupe13)

    Take a look to Extensions for Leaflet Map.

    You can group the elements on the map by criteria and show/hide them.

    Here are examples.

    Thread Starter pedrogatto

    (@pedrogatto)

    Thank you

    I already tried it. But I can’t figure out something like this:
    https://github.com/ismyrnow/leaflet-groupedlayercontrol?tab=readme-ov-file

    Plugin Contributor hupe13

    (@hupe13)

    The last example on this page is similar, but with leaflet-markers. It should work with leaflet-geojson also. If you give me an example geojson file, I can test it.

    Thread Starter pedrogatto

    (@pedrogatto)

    For example two groups with subcategory and typology

    { “type”: “FeatureCollection”, “features”: [ { “type”: “Feature”, “geometry”: { “type”: “Point”, “coordinates”: [ “12.667688”, “41.790397” ] }, “properties”: { “title”: “ahi”, “author”: “ahi”, “date”: “2024-05-26”, “category”: “le-radici”, “subcategory”: “sub4”, “typology”: “documento” } }, { “type”: “Feature”, “geometry”: { “type”: “Point”, “coordinates”: [ “12.677688”, “41.780397” ] }, “properties”: { “title”: “test”, “author”: “autore”, “date”: “2024-05-26”, “category”: “le-radici”, “subcategory”: “sub4”, “typology”: “documento” } }, { “type”: “Feature”, “geometry”: { “type”: “Point”, “coordinates”: [ “12.757688”, “41.670397” ] }, “properties”: { “title”: “test”, “author”: “autore2”, “date”: “2024-05-25”, “category”: “le-radici”, “subcategory”: “sub2”, “typology”: “giornale” } }, { “type”: “Feature”, “geometry”: { “type”: “Point”, “coordinates”: [ “12.657688”, “41.770397” ] }, “properties”: { “title”: “test”, “author”: “autore”, “date”: “2024-05-26”, “category”: “le-radici”, “subcategory”: “sub2”, “typology”: “libro” } }, { “type”: “Feature”, “geometry”: { “type”: “Point”, “coordinates”: [ “9.189634”, “45.464194” ] }, “properties”: { “title”: “viva viva la befana”, “author”: “prova”, “date”: “2024-05-18”, “category”: “le-radici”, “subcategory”: “sub2”, “typology”: “documento” } } ] }

    Plugin Contributor hupe13

    (@hupe13)

    Extensions for Leaflet Map uses the Leaflet Plugin Leaflet.FeatureGroup.SubGroup to group markers. Every marker belongs to exact one group. I realized the demo SubGroup with standard L.Control.Layers to display Nested Groups.

    But testing your geojson, I found a bug, [parentgroup] works with [leaflet-(extra)marker] only yet.

    Plugin Contributor hupe13

    (@hupe13)

    I have a new solution in version 4.3.1, please try it.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.