• Okay, new question about bounds. Is there a way to reset bounds to fit all the geojson layers if I have several?

    Thanks very much!

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

    (@bozdoz)

    That’s a good question and one that I thought about (when I thought about fitting bounds to a group of markers). I know what I would like to do, but I don’t think I could make it work. Something like this seems natural:

    
    // doesn't work
    [leaflet-map]
    [leaflet-group]
      [leaflet-marker]
      [leaflet-geojson ...]
    [/leaflet-group]

    For the marker problem I just added a property to the map to fit markers (fit_markers), because it was easy to check the javascript property on the map and add an event listener whenever a marker was added. Maybe it makes sense that you’d want ALL shapes to be visible. So what I can propose is that I can add a new property, maybe in addition to fit_markers (and competing, I guess) that is fit_all. What do you think? Basically the map would change views each time a new shape is loaded.

    Thread Starter schneidan

    (@schneidan)

    Yeah, that would do exactly what I’m planning on doing. Would that be a property on the main shotcode, then, like [leaflet-map fit_all=true]?

    Plugin Author bozdoz

    (@bozdoz)

    Yeah, that’s what I’m thinking

    Thread Starter schneidan

    (@schneidan)

    Sounds fantastic. If you’re even near Denver, I owe you a beer!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘fitbounds for multiple geojson layers’ is closed to new replies.