Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove Ukrainian flag from folium map

Tags:

leaflet

folium

Is there a way to remove the Ukrainian flag at the bottom right of a map created with folium?

enter image description here

I am happy to mention leaflet, but having a flag is a no go and I would have to stop using folium if there is no easy workaround. thank you

like image 594
crixus Avatar asked Jan 17 '26 08:01

crixus


2 Answers

It looks like folium (version 0.12.1.post1) doesn't add that flag to attributions when creating maps in Python. If you have the latest version of folium, you can simply remove it and install the version 0.12.1.post1 (maybe some slightly newer ones will work too).

In JavaScript you can try to pass attributionControl: false when creating your map, then add a new attribution control to the map, then call the setPrefix method with the Leaflet URL, and finally load tile layers on the map:

var map = L.map('map', {attributionControl: false}).setView([51.505, -0.09], 13);
var myAttrControl = L.control.attribution().addTo(map);
myAttrControl.setPrefix('<a href="https://leafletjs.com/">Leaflet</a>');

const tiles = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
    maxZoom: 19,
    attribution: 'Data by &copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>, under <a href="https://opendatacommons.org/licenses/odbl/">ODbL.</a>'
}).addTo(map);

The map will look as before, but the flag will be gone:

Leaflet map without flag

like image 112
Ratislaus Avatar answered Jan 19 '26 20:01

Ratislaus


add below class into global css

.leaflet-control-attribution {
    display: none;
  }
like image 36
Abolfazl Taghavi Avatar answered Jan 19 '26 20:01

Abolfazl Taghavi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!