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;
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:
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
Thanks for help!!
python python-3.x folium
add a comment |
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:
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
Thanks for help!!
python python-3.x folium
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
add a comment |
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:
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
Thanks for help!!
python python-3.x folium
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:
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
Thanks for help!!
python python-3.x folium
python python-3.x folium
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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")
Awesome! Nice work
– Bob Haffner
Mar 25 at 22:58
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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")
Awesome! Nice work
– Bob Haffner
Mar 25 at 22:58
add a comment |
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")
Awesome! Nice work
– Bob Haffner
Mar 25 at 22:58
add a comment |
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")
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")
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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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