Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    cyberdestroyer
    @cyberdestroyer:matrix.org
    [m]
    Hi everyone, Just wondering is there any way to plot markers on a specific date on a TimeSliderChoropleth map at all? Trying to plot a marker on a specific date and then removing it after that date has been passed on the slider. Any advice welcome!
    Cyril-Murat
    @Cyril-Murat
    Hi all. I'm new both to Github and to Gitter and I hope that my help request will not be a problem.
    Just in case someone reads...
    patty-olanterns
    @patty-olanterns
    Afternoon y'all. Wondering if any folks on here know how to add hyperlinks to a local directory file on the folium.html option. I'm trying to figure out how to add a hyperlink to a plotly chart and iterate by index position
    www2000
    @www2000
    Hi is there a way to add a symbol/marker to the center of the widget?
    I wand to mark the center for a moving map application.
    LummersGit
    @LummersGit

    Hi is there a way to add a symbol/marker to the center of the widget?
    I wand to mark the center for a moving map application.

    Could you use the centroid? I loaded data into a GeoDataFrame and then it's easy to determine the center geocode:

    for index, row in df.iterrows():
    centroid = row.geometry.centroid

    LummersGit
    @LummersGit

    Hi everyone. I've joined this Gitter in the hope of finding some active community that uses Folium. I just started using it this month.

    Can anyone share guidance on how to create 'labels' for folium.features.GeoJson? I have a lot of small polygons that I want to permanently label and the tooltip/popups are not working well for my use-case.

    I've been driving myself insane trying to come up with a solution. The main challenge I have is that all the labels resize with the map. I do not want this; I want a fixed size in meters.

    1) Tried using HTML in the DivIcon of a Marker. This works and I can create labels but they resize on zoom.

    2) I've tried permanent popups (permanent=True) on folium.GeoJsonTooltip. Same issue, the tooltip is resizing.

    3) I've even created custom text images using Python Image Library (PIL) to create PNG files that I add in using ImageOverlay. This is not resizing the images (yay) but several implementation issues: (i) the images are pixelated, the quality is poor, (ii) I am generating a lot of images (several hundred), and (iii) I want to size the labels depending on the polygon size; I want every label to stay inside its polygon but be as large as possible.

    The only element I can find in Folium that isn't resizing is folium.Circle.

    Thanks for anyone who can help me out. I can't help but feel I am missing obvious as labeling feels like it should be a basic requirement.

    Cheers!

    gmehta1996
    @gmehta1996

    Hi
    I am trying to plot some data using folium maps.
    Below is my python code and a screenshot(1st image).

        india_coord = [lat,long]
        my_map = folium.Map(location = india_coord,zoom_start=5,tiles=None,overlay=False)
        feature_group = folium.FeatureGroup(name='Central Region',overlay=True)
        feature_group2 = folium.FeatureGroup(name='South Region',overlay=True)
        feature_group3 = folium.FeatureGroup(name='East Region',overlay=True)
        feature_group4 = folium.FeatureGroup(name='West Region',overlay=True)
        feature_group5 = folium.FeatureGroup(name='North Region',overlay=True)
    
        feature_group.add_to(my_map)
        feature_group2.add_to(my_map)
        feature_group3.add_to(my_map)
        feature_group4.add_to(my_map)
        feature_group5.add_to(my_map)
    
        c1 = folium.Choropleth(
            geo_data = india,
            name = 'India',
            legend_name = 'India',
            fill_color = 'orange',
            fill_opacity = 0.3,
            highlight = True).add_to(my_map)
    
        folium.TileLayer('openstreetmap',overlay=False,name = f'SUMMARY {summ_date}').add_to(my_map)
    
    
        folium.LayerControl().add_to(my_map) 
    
        folium.Marker(location,tooltip = data1,popup = popup, icon=folium.Icon(color='cadetblue',icon = 'fa-industry', prefix='fa')).add_to(feature_group)
        ...
        ...
        ...
        folium.Marker(location,tooltip = data1,popup = popup, icon=folium.Icon(color='cadetblue',icon = 'fa-industry', prefix='fa')).add_to(feature_group5)
        my_map.add_child(feature_group)
        my_map.add_child(feature_group2)
        my_map.add_child(feature_group3)
        my_map.add_child(feature_group4)
        my_map.add_child(feature_group5)

    With this code I get the map above but I need to make another layer control option for another summary.
    For ex. if I add another

    folium.LayerControl().add_to(my_map)

    to my code I get the following(2nd Image):

    But this layer control has the same options as the above summary.
    Is there a way in folium to create different layer controls with different data on the same map so that If I am selecting the first summary in the first layer control I get the data like in image1 but if I choose the below layer control the data is displayed according to that particular layer control.
    How do I link different data with different layer control to view them on the same map.
    Thank you

    2 replies

    Image 1

    map1.png

    Image 2

    Inkedmap_screenshot_LI.jpg

    Wilson Cheung
    @wcheung-code
    Hello Folium community, I am a new member recently using folium to build out a map visualization as a side project. I am wondering if there is any status update on this issue: python-visualization/folium#1007. I find myself needing this capability to visualize raster data on the world map with temporal settings. Is there an alternate solution relying on the currently supported capabilities that folium has? Thanks!
    marcusdambrosio
    @marcusdambrosio
    Hello, I am exploring the capabilities of folium and want to see if anyone knows about this:
    When making marker clusters in folium I want to prevent the map from creating subclusters (shown below) when zooming in.
    mmap_bad.PNG
    I want only the main cluster (shown below) to display until it is zoomed in far enough to display each individual marker. Is there a way to do this?
    mmap_good.PNG
    Here is a simplified example of the code I am using
    import pandas as pd
    import folium
    from folium.plugins import MarkerCluster
    import shapely.wkt
    
    data = pd.read_csv('crops.csv', index_col='UniqueID')
    field = data.iloc[50, :]
    pgon = shapely.wkt.loads(field['geometry'])
    coords = [[j,i] for i,j,k in list(pgon.exterior.coords)]
    mmap = folium.Map(location = coords[0], zoom_start = 20)
    folium.PolyLine(locations=coords,
                    line_opacity=0.5).add_to(mmap)
    MarkerCluster(coords).add_to(mmap)
    display(mmap)
    marcusdambrosio
    @marcusdambrosio
    Thank you in advance!
    Vedant S Goyal
    @vsgo222

    Hi community. I have question related to selecting a feature object after using a search. I want to highlight the searched feature, so that it is selected. Here is my code.
    '''
    from folium.plugins import Search
    search_link = Search(layer=pct_feature_group, geom_type="LineString", placeholders = "Search for Link ID",
    collapsed="True", search_label = 'id', search_zoom = 17, position='topleft',
    ).add_to(pct_m)

    ratio

    step_pct.add_to(pct_m)
    pct_m
    '''
    How should I insert the highlight_function?

    Jeremy Mathew
    @Jerry-Mah
    Hello
    MyasinE
    @MyasinE
    Hi , I am using "folium.Map(location, zoom_start=14)" in python script. I need web address followed by the library because I have a firewall and I want to give permission for this lib . For first step , I give an access permission for "www.openstreetmap.org" but I coulnd'nt see any map on the script.
    Chris Hoina
    @chrishoina
    Hi all. I'm working on a project for work to demo our APIs with folium. And I can't seem to find the answer anywhere. For markers, I know that I have to indicate the lat/long coordinates. But when I try to add a vega-lite chart (doing this with Altair), I can't seem to figure out how to inform the marker as to which chart goes in which popup. I have one API coming for lat/long and the name of the location. And I have another API coming in that provides the data to populate the chart. They do share a unique ID, but I'm not sure how to go about this. Has anybody on here faced a similar scenario? Thanks!
    João Martins | Spatial Data Scientist | MSc Env. Eng.
    @joaoambiente

    Hi everyone, Just wondering is there any way to plot markers on a specific date on a TimeSliderChoropleth map at all? Trying to plot a marker on a specific date and then removing it after that date has been passed on the slider. Any advice welcome!

    I've got this very same question, but can simplify it by asking one that might be simpler to answer:

    • How may I retrieve the date output from TimeSliderChoropleth (current date in the slider)?
    João Martins | Spatial Data Scientist | MSc Env. Eng.
    @joaoambiente
    Ray
    @rayrrr
    Hello all, I'm a folium fan, and trying to grok how the templates fit together with the Python code. When I look at a template like https://github.com/python-visualization/folium/blob/main/folium/templates/tiles/openstreetmap/tiles.txt I see what looks like the contents of a Python f-string with four variables: s, x, y, and z. Where in the Python code are these template f-strings invoked, so I can see how these variables are populated?
    1 reply
    Victor Cubas
    @VictorCubas
    4.jpg Can anyone help me how to edit position of all markers from featuregroup once you clic on "edit"???
    IndigoWizard
    @IndigoWizard
    Is anyone using the new "GroupedLayerControl" folium plugin and managed to group raster layers (e.g: google earth engine layers) instead of just vector layers (markers, polygons from geojson ...etc)?