<jupyter_start><jupyter_text>Contributing to Folium   $(document).ready(function(){    $("inline_data_1, inline_data_2, inline_data_3").hide();    $(".button_1").click(function(){        $("inline_data_1").toggle();    });    $(".button_2").click(function(){        $("inline_data_2").toggle();    });    $(".button_3").click(function(){        $("inline_data_3").toggle();    });});  What is Folium?Folium is a easy to use leaflet JavaScript wrapper for Python. It allows you to create interactive maps much like Google maps but with your own data laid over the top. It does this by accessing a tile server to add a background image to that point in space that you are in (x,y,z) the latitude, longitude and zoom level. For example:If we want a tile at (z,x,y) = (1,1,1) we can view this using the tile server API by going to https://cartodb-basemaps-1.global.ssl.fastly.net/light_all/1/1/1.png we would receive a tile with lat, lon and zoom of 1 (notice the way the path of the URL ends in /1/1/1.png, this corresponds to /{z}/{x}/{y}.pngSimilarly we could get (z,x,y) = (3, 1, 2) The good news is, that by using Leaflet/Folium we don't need to worry about such details. We simply need to create a map and the JavaScript library will do all of this behind the scenes for us! Let's look at a brief example:<jupyter_code>import folium

m = folium.Map(
    location=[56.096555, -3.64746],
    tiles = 'cartodbpositron',
    zoom_start=5
)

m<jupyter_output><empty_output><jupyter_text>That was incredibly easy, we have created a map centered around the United Kingdom, at a zoom level of 5 and using this minimalistic style dubbed 'cartodbpositron'.  How do you contribute to Folium?Folium is a free open source library - that means it is developed and maintained by volunteers and as such it realizes on users feedback and them getting involved with fixes, extra features and assisting with documentation. If you are new to an open source library and don't feel like you can contribute much to the code then I would implore you to contribute to their documentation, as you are the perfect candidate, you have gone through the learning curve and can impart that knowledge onto other users. Short tutorial on contributing to open source libraries:[](https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github) Also if you run into any issues while using the library and have looked through all the documentation then head over to the 'issues' page on the library's GitHub page and inform them so they can look at improving their functionality/documentation.  My latest contributions  How to download and use the new features before the pull request is accepted> Install git on your machine>`!pip uninstall -y folium && pip install git+https://github.com/ghandic/folium.git@master` Quick download function<jupyter_code>import urllib.request, json 

def downloadJson(link):
    
    with urllib.request.urlopen(link) as url:
        data = json.loads(url.read().decode())
    
    return data<jupyter_output><empty_output><jupyter_text>GeoJsonCssGeoJson is a file format that specifies the geometry of the shapes you wish to visualize as well as the properties associated with that point. The following example denotes a geometry which is a point type, it is located at (37.61001, 55.752301). The point represents Vladamir's house so we have added some properties to the point, in this case 'title' and 'age'.Show/Hide data{    "type": "FeatureCollection",    "features": [        {            "type": "Feature",            "properties": {                "title": "Vladamir's house",                "age" : 400            },            "geometry": {                "type": "Point",                "coordinates": [37.61001, 55.752301]            }        }    ]}However, if we were to plot this using Folium's GeoJson method we would get a default marker - not very customizable, one solution would be to go into the Folium packages JavaScript and hack it ourselves as an add-hoc way to get the beautiful looking plot that we had planned. However, this would not work for other users of Folium, so instead we can look outward to see if there are any JavaScript library plugins for Leaflet. In this case there was already a library for what we need, it is called GeoJsonCss, which allows you to pass through the style for your geometries inside the GeoJson object. How do we use the new GeoJsonCss method?This new GeoJson method is an elegant way to pass through the styles for your data points. Here is the same point before, but this time it will be displayed with a house icon and a pop-up window that contains the title of the point.Show/Hide data{    "type": "FeatureCollection",    "features": [        {            "type": "Feature",            "properties": {                "title": "Vladamir's house",                "age" : 400            },            "geometry": {                "type": "Point",                "coordinates": [37.61001, 55.752301]            },            "style": {                "icon": {                    "iconUrl": "http://downloadicons.net/sites/default/files/small-house-with-a-chimney-icon-70053.png",                    "iconSize": [32, 32],                    "iconAnchor": [16, 16]                }            },            "popupTemplate": "{title}"        }    ]} Let's see it in action!  Original vs New<jupyter_code>import folium
vlad = downloadJson("https://raw.githubusercontent.com/ghandic/folium/master/examples/data/vlad.json")
GeoJson = folium.Map(location=[55.75258, 37.61489], zoom_start=14, tiles = 'cartodbpositron')

folium.GeoJson(vlad).add_to(GeoJson)
GeoJson
GeoJsonCss = folium.Map(location=[55.75258, 37.61489], zoom_start=14, tiles = 'cartodbpositron')

folium.GeoJsonCss(vlad).add_to(GeoJsonCss)
GeoJsonCss<jupyter_output><empty_output><jupyter_text>TimeStamped GeoJsonAs we have seen the GeoJson file format is very good at adding properties which make it very accessible for the JavaScript libraries to use. Another piece of information we can encode into this file format is a time dimension. This can be very useful for visualizing the spatial-temporal variation (how things change over space and time). For example, one may wish to see where they had lived over the course of their life.In this contribution I hacked a little bit of the JavaScript to add some styling to the points and make the time slider look more human readable by allowing the user to pass through a time format.Here is a small example of the GeoJson that is required to produce a spatial-temporal visualization, it depicts a persons movement over time with the house surrounded by a green circle being their most recent house up till that point:Show/Hide data{'features': [{'geometry': {'coordinates': [-2.548828, 51.467697],    'type': 'Point'},   'properties': {'icon': 'marker',    'iconstyle': {'iconSize': [20, 20],     'iconUrl': 'http://downloadicons.net/sites/default/files/small-house-with-a-chimney-icon-70053.png'},    'popup': '&lt;h1&gt;address1&lt;/h1&gt;',    'time': '2017-06-02'},   'type': 'Feature'},  {'geometry': {'coordinates': [-0.087891, 51.536086], 'type': 'Point'},   'properties': {'icon': 'marker',    'iconstyle': {'iconSize': [20, 20],     'iconUrl': 'http://downloadicons.net/sites/default/files/small-house-with-a-chimney-icon-70053.png'},    'popup': '&lt;h2 style="color:blue;"&gt;address2&lt;/h2&gt;',    'time': '2017-07-02'},   'type': 'Feature'},  {'geometry': {'coordinates': [-6.240234, 53.383328], 'type': 'Point'},   'properties': {'icon': 'marker',    'iconstyle': {'iconSize': [20, 20],     'iconUrl': 'http://downloadicons.net/sites/default/files/small-house-with-a-chimney-icon-70053.png'},    'popup': '&lt;h2 style="color:orange;"&gt;address3&lt;/h2&gt;',    'time': '2017-08-02'},   'type': 'Feature'},  {'geometry': {'coordinates': [-1.40625, 60.261617], 'type': 'Point'},   'properties': {'icon': 'marker',    'iconstyle': {'iconSize': [20, 20],     'iconUrl': 'http://downloadicons.net/sites/default/files/small-house-with-a-chimney-icon-70053.png'},    'popup': '&lt;h2 style="color:green;"&gt;address4&lt;/h2&gt;',    'time': '2017-09-02'},   'type': 'Feature'},  {'geometry': {'coordinates': [-1.516113, 53.800651], 'type': 'Point'},   'properties': {'icon': 'marker',    'iconstyle': {'iconSize': [20, 20],     'iconUrl': 'http://downloadicons.net/sites/default/files/small-house-with-a-chimney-icon-70053.png'},    'popup': '&lt;h2 style="color:green;"&gt;address5&lt;/h2&gt;',    'time': '2017-10-02'},   'type': 'Feature'},  {'geometry': {'coordinates': [[-2.548828, 51.467697],     [-0.087891, 51.536086],     [-6.240234, 53.383328],     [-1.40625, 60.261617],     [-1.516113, 53.800651]],    'type': 'LineString'},   'properties': {'icon': 'circle',    'iconstyle': {'fillColor': 'green',     'fillOpacity': 0.6,     'radius': 13,     'stroke': 'false'},    'popup': 'Current address',    'style': {'weight': 0},    'times': ['2017-06-02',     '2017-07-02',     '2017-08-02',     '2017-09-02',     '2017-10-02']},   'type': 'Feature'}], 'type': 'FeatureCollection'}The next step for this plugin is to get it to work with GeoJsonCss so that the styling is consistent throughout the Folium library Let's see it in action!<jupyter_code>import folium
from folium import plugins

spatial_temporal_data = downloadJson("https://raw.githubusercontent.com/ghandic/folium/master/examples/data/house_movement.json")

m = folium.Map(
    location=[56.096555, -3.64746],
    tiles = 'cartodbpositron',
    zoom_start=5
)

plugins.TimestampedGeoJson(spatial_temporal_data, 
            period='P1M', add_last_point=True,
            auto_play=False, loop=False, 
            maxSpeed=1, loopButton=True,
            dateOptions='YYYY/MM/DD',
            timeSliderDragUpdate=True).add_to(m)

m<jupyter_output><empty_output><jupyter_text>Search Layer PluginThis plugin was in response to a request made on the issues page for Folium, as a user wanted the Folium package to incorporate a leaflet plugin called [leaflet-search](https://github.com/stefanocudini/leaflet-search) which allows you to 'search stuff' as the author *<NAME>* puts it. To use this plugin we require the user to use a single GeoJson object into the search layer. The next steps for this plugin will be to enable fuzzy match, have more options for geometries than Polygon/Point and have multiple search layers, as at present there is only the ability to search through a single layer.  Loading some data<jupyter_code>bars = downloadJson("https://raw.githubusercontent.com/ghandic/folium/master/examples/data/bars.json")
    
states = downloadJson("https://raw.githubusercontent.com/ghandic/folium/master/examples/data/us-states.json")<jupyter_output><empty_output><jupyter_text>Adding in some style Note this does not work too well with polygons as it resets the style to the default rather than the initial settings. Issue has been raised on the leaflet-plugin GitHub [page](https://github.com/albburtsev/Leaflet.geojsonCSS/issues/4)<jupyter_code>for bar in bars['features']:
    bar['style'] = {"icon": {
        "iconUrl": "https://d30y9cdsu7xlg0.cloudfront.net/png/80776-200.png",
        "iconSize": [16, 16]}}
    bar["popupTemplate"] = "<strong>{name}</strong>"<jupyter_output><empty_output><jupyter_text>Using the plugin<jupyter_code>import folium
from folium import plugins
m = folium.Map(
    location=[41.9,12.5],
    tiles = 'cartodbpositron',
    zoom_start=11
)

plugins.Search(bars, position='topright',
               search_zoom=20,
               search_label='name',
               geom_type="Point",
               popup_on_found=True).add_to(m) 

m
m = folium.Map(
    location=[37.8, -96],
    tiles = 'cartodbpositron',
    zoom_start=3 
)

plugins.Search(states, search_zoom=6,
               position='topright',
               search_label='name',
               geom_type="Polygon").add_to(m) 

m<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12574398524603905, 'fraction_numerical': 0.0402380752787325, 'mean_word_length': 3.752988047808765, 'pattern_counts': {'":': 25, '<': 32, '<?xml version=': 0, '>': 34, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 15, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '651334', 'license': 'MIT', 'n_tokens_mistral': 3894, 'n_tokens_neox': 3520, 'n_words': 1224, 'path': 'Contributing to Folium.ipynb', 'repo_name': 'ghandic/contribs', 'size': '11937'}