Leaflet map plugin

I have the Leaflet map plugin installed https://sycom.github.io/TiddlyWiki-Plugins/#Leaflet%20maps%20plugin and it works (almost), but the initial map displayed is zoomed too far in and no map is actually displayed so you have to back off the zoom by one step each time you open a Tiddler.

The documentation on the page says that there is an attribute you can set to specify the zoom level but I cannot work out where this is used - as a field in the Tiddler or in the plugin code?

Is anyone else using this plugin and is familiiar with how to set the attributes?

Thanks.

1 Like

You put it in the macro call.

<$leafmap tileControl cluster=“30”
places=’{“tiddller name”} zoom=“10” />

I think… :slight_smile:

1 Like

@myfta Thank you for the question. I’ve been living with this issue as well. It is only an issue when one point is to be mapped. I do not need this paramater when there are multiple points. Therefore I have only implemented the zoom parameter when the filter yields 1 point. @Ste_W Thank you for the answer. This works well.

Craig

I think the reason for this is the maximum zoom level supported by ‘osm’ is 19. Conversely ‘sat’ also seems to work to 19 rather than 18 in the documentation. ‘osmbw’ does notwork at all for me.

I have now discovered a better fix for this problem.

Edit the shadow Tiddler $:/plugins/sycom/leaflet/lib/tileLayers.json

Change zMax for “osm” to read:

  "zMin": 1,
  "zMax": 19
1 Like

I have not been using this one. However, I see what you mean. I tried changing tileLayers.json, but without luck. When I look at the Browser’s development window I see the error. Each image in the leaflet that it needs to display returns an error:

401 - The requested resource is no longer available on this server and there is no forwarding address. Please remove all references to this resource.

Does your entry look like this?

{
      "id": "osm",
      "nom": "OpenStreetMap",
      "url": "https://{s}.tile.osm.org/{z}/{x}/{y}.png",
      "attrib": "Map tiles by &copy;<a href='http://osm.org/copyright'>OSM</a>, licence <a href='http://creativecommons.org/licenses/by-sa/3.0'>CC BY SA</a>. Data by &copy;<a href='http://openstreetmap.org'>OSM</a> contributors, licence <a href='http://opendatacommons.org/licenses/odbl/'>ODbL</a>.",
      "zMin": 1,
      "zMax": 19
   },

There are usage rules.

https://operations.osmfoundation.org/policies/tiles/

Thanks,

Craig

Maybe I edited the wrong entry… I also changed this… without luck:

    {
        "id": "osmbw",
        "nom": "OSM N&B",
        "url": "http://www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png",
        "attrib": "Tiles hosted by wikimedia labs. Data by &copy;<a href='http://openstreetmap.org'>OSM</a> contributors, licence <a href='http://opendatacommons.org/licenses/odbl/'>ODbL</a>.",
        "zMin": 1,
        "zMax": 19
    },

I can’t get “osmbw” to work at all, whatever the zoom.

I figured out they changed servers…

Try changing the url for osmbw, from this:

"url": "http://www.toolserver.org/tiles/bw-mapnik/{z}/{x}/{y}.png",

this to:

"url": "https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png",

Hmm, I cant get that to work.