Leaflet map plugin - filtering Feature collection geojson

99 views
Skip to first unread message

Darek Bobak

unread,
Sep 21, 2020, 5:28:44 PM9/21/20
to TiddlyWiki
Is it possible to display on the map only selection of features (by name or other property) from geojson containing a multiple locations - FeatureCollection.

Sample geojson:
{
  "type""FeatureCollection",
  "features": [
    {
      "type""Feature",
      "geometry": {
        "type""Point",
        "coordinates": [
          13.190206,
          48.649078
        ]
      },
      "properties": {
        "name""Albersdorf",
        "type""Open",
        "elevation"""
      }
    },
    {
      "type""Feature",
      "geometry": {
        "type""Point",
        "coordinates": [
          12.190206,
          48.649078
        ]
      },
      "properties": {
        "name""Pfellnkofen",
        "type""Open",
        "elevation"""
      }
    }
  ]
}

best,
Darek

Sycom

unread,
Sep 22, 2020, 6:03:27 AM9/22/20
to TiddlyWiki
Hi Darek,

I can reply very shortly to this I'm afraid : no.

The filter parameter in Leaflet map plugin was only designed for tiddlers. And I guess that filter in TiddlyWiki was not designed for such complex json neither. May be Joshua's JSON mangler plugin can help? I do not know them enough to say.

As a workaround, you may convert your json data to tiddlers with an external script, import them and then use filter.

Cheers,

Sylvain
@sycom

Darek Bobak

unread,
Sep 22, 2020, 6:09:22 AM9/22/20
to TiddlyWiki
Ok, I understand. I'm playing with JSON Mangler now.

And another question: when I create tiddler with geo data (like, field "point" with coordinates), the map is displayed in tiddler by default. Is it possible to turn the map off? I would like rather display it by the $leafmap widget in view template.

cheers,
Darek

Sycom

unread,
Sep 22, 2020, 7:59:20 AM9/22/20
to TiddlyWiki
Definitely,

it's a known issue. I will add a setting button to enable / disable this (one day), but for now you will have to make it "by hand" :
  1. go to  $:/plugins/sycom/leaflet/templates/geoTiddler  template tiddler
  2. edit it,
  3. remove $:/tags/ViewTemplate tag and save.
Or you may edit this template to fit your taste...

Cheers

Sylvain
@sycom

Darek Bobak

unread,
Sep 22, 2020, 11:13:38 AM9/22/20
to TiddlyWiki
Great! Thanks!
Reply all
Reply to author
Forward
0 new messages