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

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현