• Resolved riondu76

    (@riondu76)


    Hi,

    I have maps with multiple markers on a page, and some markers are on the edge of the map, almost cut. Is there a way to correct this issue ?
    Also, I have a page with 7 maps with multiples markers on each, and when loading the page, some maps are all grey…(markers are visible, but not the map background).
    Could you help me please ?

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

    (@bozdoz)

    fitbounds could be changed to add padding; you could do this manually but it may be difficult.

    The issue with the grey maps I wonder if it’s just zoomed in really close?

    Thread Starter riondu76

    (@riondu76)

    Hi, thanks for your answer.
    Padding could be add in css ? or in another way (which one ? ) ?
    I really need to fix this…

    Yes, grey maps, if you zoom out, it’s ok. But my maps are generated, I have custom post type, so I take all adresses, and make a map with one or several markers. Fixing a zoom in a fitbounds map haven’t work for me.

    Thread Starter riondu76

    (@riondu76)

    solved for grey map with
    echo do_shortcode(‘[leaflet-map address=”‘.$adresse.'”]’);
    echo do_shortcode(‘[leaflet-marker]’.$title.'[/leaflet-marker]’);
    just put default zoom at 15 in leaflet options.

    but for maps with
    echo do_shortcode(‘[leaflet-map fitbounds]’);
    …while….
    echo do_shortcode(‘[leaflet-marker address=”‘.$adresse.'”]‘.$nom_gite.’[/leaflet-marker]’);

    it doesn’t change anything. When I have only 1 address in my fitbounds map, it’s zoomed really close by default.
    Thanks for your help

    As a workaround could you add some javascript to zoom out one level after the fit-bounds map loads?

    Thread Starter riondu76

    (@riondu76)

    Hi pbhj,

    I really don’t know how I could do this. Do you have any idea ?
    Thank you

    Plugin Author bozdoz

    (@bozdoz)

    I do not recommend fitting bounds to a single marker. It makes sense why it would be so tight: It’s a single point!

    Perhaps if you want a radius around the marker you could create a transparent circle around the marker:

    [leaflet-map fitbounds address=”Toronto”]
    [leaflet-marker]
    [leaflet-circle radius=20000 opacity=0 fillOpacity=0]

    You can play around with the radius if you like (units are meters). I just tested this and it seems to be a good work around for this use-case.

    Thread Starter riondu76

    (@riondu76)

    Hi Bozdoz,

    yes I know it’s a single point, but I have made a template page for an archive of custom post type, and sometimes, there is only one result. I think I’m going to test if I only have one result, and then make a map without fitbounds for this case.

    Also, for the other problem, I would like to know how to make a padding (on a fidbounds map with 7 poitns, 2 of them are close to the border of the map…) ? I have 6 maps on the same page, figuring all markers for 6 differents terms of custom post type.
    Thanks

    Plugin Author bozdoz

    (@bozdoz)

    you could add a circle for any and all addresses:

    [leaflet-map fitbounds]
    [leaflet-marker address=”vancouver”]
    [leaflet-circle address=”vancouver” radius=2000 opacity=0 fillOpacity=0]
    [leaflet-marker address=”halifax”]
    [leaflet-circle address=”halifax” radius=2000 opacity=0 fillOpacity=0]

    it shouldn’t matter how many markers you have, you can add padding to fitbounds in the same way.

    Thread Starter riondu76

    (@riondu76)

    Great, it works !
    I had to put radius to 11000 to see a difference.
    Thanks a lot, that’s a very usefull plugin, you did a great job !

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘fitbounds too tight’ is closed to new replies.