Add menu bar on folium map to select or deselect particular object (Marker)Add heatmap to a layer in FoliumPixelate Image With PillowDeleting a marker from folium mapChange marker in folium mapFolium Choropleth map marker is not workingCan I add a sequence of markers on a Folium map?Folium & Map object has not attribute MarkerNumbers in map marker in FoliumData association/fusion of multiple objects from multiple (unreliable) sensorsTemperature numbers in map marker in FoliumAdding markers to a Folium Map

What can a novel do that film and TV cannot?

Is there ever a reason not to use Java 8's parallelSort?

Sleepy tired vs physically tired

Magento 2 Professional Developer certification study guidelines

3D nonogram – What's in the box?

How frequently do Russian people still refer to others by their patronymic (отчество)?

Does Evolution Sage proliferate Blast Zone when played?

administrative duties kill the research spirit?

How do both sides know the MTU

Contributing to a candidate as a Foreign National US Resident?

Why would a propellor have blades of different lengths?

Using Sed to add counter to keyword

What does it mean for a bass player to play "on the one"?

How can one synthesise a conjugated alkyne chain?

Bypass with wrong cvv of debit card and getting OTP

Can a wizard delay learning new spells from leveling up to learn different spells later?

My players like to search everything. What do they find?

What is the addition in the re-released version of Avengers: Endgame?

Should I hide my travel history to the UK when I apply for an Australian visa?

Is it bad to suddenly introduce another element to your fantasy world a good ways into the story?

Why is the order of my features changed when using readFeatures in OpenLayers v4.6.5?

How did Einstein know the speed of light was constant?

What are the differences of checking a self-signed certificate vs ignore it?

Who pays for increased security measures on flights to the US?



Add menu bar on folium map to select or deselect particular object (Marker)


Add heatmap to a layer in FoliumPixelate Image With PillowDeleting a marker from folium mapChange marker in folium mapFolium Choropleth map marker is not workingCan I add a sequence of markers on a Folium map?Folium & Map object has not attribute MarkerNumbers in map marker in FoliumData association/fusion of multiple objects from multiple (unreliable) sensorsTemperature numbers in map marker in FoliumAdding markers to a Folium Map






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I've built a cool map like the one below but with more objects.



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]

folium.PolyLine(locations=line_points, weight=3,color = 'yellow').add_to(base_map)


base_map.save("example_map.html")


result:



enter image description here



Q: I wonder if there is a way to build some kind of menu bar that would enable to select particular object from the map. e.g. only cars, only train or cars and yellow line.



It won't be part any of the website - just a solution to incorporate in .html file, like the one below



enter image description here



Thanks for help!!










share|improve this question

















  • 1





    Yes, you're in luck. Feature Groups and a Layer Control is what you want. I answered a similar question recently stackoverflow.com/a/54756617/3437504

    – Bob Haffner
    Mar 25 at 20:35

















0















I've built a cool map like the one below but with more objects.



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]

folium.PolyLine(locations=line_points, weight=3,color = 'yellow').add_to(base_map)


base_map.save("example_map.html")


result:



enter image description here



Q: I wonder if there is a way to build some kind of menu bar that would enable to select particular object from the map. e.g. only cars, only train or cars and yellow line.



It won't be part any of the website - just a solution to incorporate in .html file, like the one below



enter image description here



Thanks for help!!










share|improve this question

















  • 1





    Yes, you're in luck. Feature Groups and a Layer Control is what you want. I answered a similar question recently stackoverflow.com/a/54756617/3437504

    – Bob Haffner
    Mar 25 at 20:35













0












0








0


1






I've built a cool map like the one below but with more objects.



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]

folium.PolyLine(locations=line_points, weight=3,color = 'yellow').add_to(base_map)


base_map.save("example_map.html")


result:



enter image description here



Q: I wonder if there is a way to build some kind of menu bar that would enable to select particular object from the map. e.g. only cars, only train or cars and yellow line.



It won't be part any of the website - just a solution to incorporate in .html file, like the one below



enter image description here



Thanks for help!!










share|improve this question














I've built a cool map like the one below but with more objects.



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
folium.Marker(tuple_, icon=icon).add_to(base_map)

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]

folium.PolyLine(locations=line_points, weight=3,color = 'yellow').add_to(base_map)


base_map.save("example_map.html")


result:



enter image description here



Q: I wonder if there is a way to build some kind of menu bar that would enable to select particular object from the map. e.g. only cars, only train or cars and yellow line.



It won't be part any of the website - just a solution to incorporate in .html file, like the one below



enter image description here



Thanks for help!!







python python-3.x folium






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 18:42









Mateusz KonopelskiMateusz Konopelski

3531 gold badge4 silver badges16 bronze badges




3531 gold badge4 silver badges16 bronze badges







  • 1





    Yes, you're in luck. Feature Groups and a Layer Control is what you want. I answered a similar question recently stackoverflow.com/a/54756617/3437504

    – Bob Haffner
    Mar 25 at 20:35












  • 1





    Yes, you're in luck. Feature Groups and a Layer Control is what you want. I answered a similar question recently stackoverflow.com/a/54756617/3437504

    – Bob Haffner
    Mar 25 at 20:35







1




1





Yes, you're in luck. Feature Groups and a Layer Control is what you want. I answered a similar question recently stackoverflow.com/a/54756617/3437504

– Bob Haffner
Mar 25 at 20:35





Yes, you're in luck. Feature Groups and a Layer Control is what you want. I answered a similar question recently stackoverflow.com/a/54756617/3437504

– Bob Haffner
Mar 25 at 20:35












1 Answer
1






active

oldest

votes


















2














Thanks to @BobHaffner I found my solution. Thanks Bob!



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

train_group = folium.FeatureGroup(name="Trains").add_to(base_map)

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
train_group.add_child(folium.Marker(tuple_, icon=icon))

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

cars_group = folium.FeatureGroup(name="Cars").add_to(base_map)

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
cars_group.add_child(folium.Marker(tuple_, icon=icon))

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]


lines_group = folium.FeatureGroup(name="Lines").add_to(base_map)

lines_group.add_child(folium.PolyLine(locations=line_points, weight=3,color = 'yellow'))

folium.LayerControl().add_to(base_map)

base_map.save("example_map.html")





share|improve this answer























  • Awesome! Nice work

    – Bob Haffner
    Mar 25 at 22:58










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344513%2fadd-menu-bar-on-folium-map-to-select-or-deselect-particular-object-marker%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














Thanks to @BobHaffner I found my solution. Thanks Bob!



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

train_group = folium.FeatureGroup(name="Trains").add_to(base_map)

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
train_group.add_child(folium.Marker(tuple_, icon=icon))

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

cars_group = folium.FeatureGroup(name="Cars").add_to(base_map)

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
cars_group.add_child(folium.Marker(tuple_, icon=icon))

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]


lines_group = folium.FeatureGroup(name="Lines").add_to(base_map)

lines_group.add_child(folium.PolyLine(locations=line_points, weight=3,color = 'yellow'))

folium.LayerControl().add_to(base_map)

base_map.save("example_map.html")





share|improve this answer























  • Awesome! Nice work

    – Bob Haffner
    Mar 25 at 22:58















2














Thanks to @BobHaffner I found my solution. Thanks Bob!



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

train_group = folium.FeatureGroup(name="Trains").add_to(base_map)

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
train_group.add_child(folium.Marker(tuple_, icon=icon))

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

cars_group = folium.FeatureGroup(name="Cars").add_to(base_map)

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
cars_group.add_child(folium.Marker(tuple_, icon=icon))

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]


lines_group = folium.FeatureGroup(name="Lines").add_to(base_map)

lines_group.add_child(folium.PolyLine(locations=line_points, weight=3,color = 'yellow'))

folium.LayerControl().add_to(base_map)

base_map.save("example_map.html")





share|improve this answer























  • Awesome! Nice work

    – Bob Haffner
    Mar 25 at 22:58













2












2








2







Thanks to @BobHaffner I found my solution. Thanks Bob!



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

train_group = folium.FeatureGroup(name="Trains").add_to(base_map)

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
train_group.add_child(folium.Marker(tuple_, icon=icon))

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

cars_group = folium.FeatureGroup(name="Cars").add_to(base_map)

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
cars_group.add_child(folium.Marker(tuple_, icon=icon))

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]


lines_group = folium.FeatureGroup(name="Lines").add_to(base_map)

lines_group.add_child(folium.PolyLine(locations=line_points, weight=3,color = 'yellow'))

folium.LayerControl().add_to(base_map)

base_map.save("example_map.html")





share|improve this answer













Thanks to @BobHaffner I found my solution. Thanks Bob!



import folium

base_map = folium.Map(location=[52.2297, 21.0122], control_scale=True, zoom_start=10)

points1 = [(52.228771, 21.003146),

( 52.238025, 21.050971),
(52.255008, 21.036172),
(52.252831, 21.051385),
(52.219995, 20.965021)]

train_group = folium.FeatureGroup(name="Trains").add_to(base_map)

for tuple_ in points1:

icon=folium.Icon(color='white', icon='train', icon_color="red", prefix='fa')
train_group.add_child(folium.Marker(tuple_, icon=icon))

points2 = [(52.239062, 21.131601),

(52.204905, 21.168202),
(52.181296, 20.987486),
(52.206272, 20.914988),
(52.254395, 21.224107)]

cars_group = folium.FeatureGroup(name="Cars").add_to(base_map)

for tuple_ in points2:
icon=folium.Icon(color='white', icon='car', icon_color="blue", prefix='fa')
cars_group.add_child(folium.Marker(tuple_, icon=icon))

line_points = [(52.204905, 21.168202),(52.255008, 21.036172), (52.219995, 20.965021), (52.239062, 21.131601), (52.254395, 21.224107)]


lines_group = folium.FeatureGroup(name="Lines").add_to(base_map)

lines_group.add_child(folium.PolyLine(locations=line_points, weight=3,color = 'yellow'))

folium.LayerControl().add_to(base_map)

base_map.save("example_map.html")






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 22:10









Mateusz KonopelskiMateusz Konopelski

3531 gold badge4 silver badges16 bronze badges




3531 gold badge4 silver badges16 bronze badges












  • Awesome! Nice work

    – Bob Haffner
    Mar 25 at 22:58

















  • Awesome! Nice work

    – Bob Haffner
    Mar 25 at 22:58
















Awesome! Nice work

– Bob Haffner
Mar 25 at 22:58





Awesome! Nice work

– Bob Haffner
Mar 25 at 22:58








Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid …


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55344513%2fadd-menu-bar-on-folium-map-to-select-or-deselect-particular-object-marker%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?