• Greetings! I am starting to put together a site using this plugin and I keep beating around the bush whether or not I’m going to use it or I’m going to write something custom. I am definitely leaning toward using this, though, so maybe I can help with this feature request.

    I’m working on adding gpx files, kml files, images, and posts to maps in wordpress, covering the hike and bike trips I’ve done and plan to do in the future. Because of this, I’m going to be 1) making a lot of posts, one for each day, typically. And 2) using various custom tile sources. For instance: using Japan’s topo maps for trips in Japan, NZ’s topo maps for trips in NZ, etc. A “reasonable default” is great, but there are likely going to be more overrides than not.

    Doing these overrides right now is easy. Add the tileurl parameter to the leaflet-map, add min_zoom, max_zoom, where needed. This is fine. On an individual basis. But doing it across a large number of posts is fairly cumbersome. Additionally, if I ever need to update any of these map sources, I have to go edit all of the existing places that map source is being used, which could number in the dozens or more.

    Thus I’d like to suggest having the ability to create pre-defined map sources in leaflet-js that you can specify in your shortcodes. You’d give the map source a slug, and reference that slug in your shortcode. This would make it so you can centralize settings for that particular map source, which would make updating them significantly easier. You only need to update the information in one place: leaflet-map’s settings.

    If this seems like a reasonable feature request, I’d like to make an attempt at implementing it. If you have any suggestions or requirements or ideas that I could implement prior to sending the code your way, I’d love to hear them. Anything that would ease integration of this into upstream ??

    As a bonus feature, it *could* be nice to allow custom snippets for certain map sources. The use case I have in mind here is esri maps, which are, in my opinion, most cleanly implemented by pulling in their leaflet-esri plugin and specifying their tile layer directly. It handles changing the attributions around and such. And that could help make it easier for people wanting to use custom plugins, at least for tile sources, to be able to do so without either making local modifications (my current method, which I’m not super happy with) or trying (and failing) to get a change into upstream to support their bespoke tile layer plugin! ??

    I have no idea how that last bit would be implemented, or if there might be a better way to do it than the “paste a block of code into a form” implementation I’m thinking of, maybe something something hooks or filters? I’m very new to WP plugin development so I may be way off track. This bit is not nearly as important, however, as I’ve been able to find alternative tile layers for Japan and NZ which have the bits that I want, without having to pull in the complexity of esri.

    Thoughts?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author bozdoz

    (@bozdoz)

    I like the idea. I don’t have any initial thoughts on how to implement it. Sounds like you’ll have to add something in the admin for a pre-defined map. Good luck! Check the github repo for something to work off.

    Thread Starter jkitchen

    (@jkitchen)

    Ok, I’ll poke a bit at it and try to get you a PR soon! Thanks!

    Thread Starter jkitchen

    (@jkitchen)

    Just FYI I didn’t forget about this but I am close to running out of time to make this happen before I depart for my trip, and my carpal tunnel is acting up so it’s unlikely to happen before then. If you’d like what I have so far, I can make a patch out of what I have. It’s not much, but it’s not nothing!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘pre-defined tile layer sources?’ is closed to new replies.