How to use the branca.element function in branca

To help you get started, we’ve selected a few branca examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BibMartin / crossfolium / tests / test_marker_function.py View on Github external
def test_no_marker_function():
    f = branca.element.Figure()
    c = crossfolium.Crossfilter([{'lat': 0, 'lng': 0}]).add_to(f)
    m = folium.Map().add_to(c)
    crossfolium.FeatureGroupFilter(c).add_to(m)

    out = ''.join(f.render().split())
    tmp = ''.join("""
        .marker_function = function(d) {
            return L.marker([0, 0]);}
        """.split())
    assert tmp in out
github python-visualization / branca / tests / test_iframe.py View on Github external
def test_create_iframe():
    iframe = elem.IFrame(html='<p>test content</p><p>', width=60, height=45)
    iframe.render()
</p>
github python-visualization / branca / tests / test_iframe.py View on Github external
def test_create_empty_iframe():
    iframe = elem.IFrame()
    iframe.render()
github BibMartin / crossfolium / tests / test_marker_function.py View on Github external
def test_circle_marker_function():
    f = branca.element.Figure()
    c = crossfolium.Crossfilter([{'lat': 0, 'lng': 0}]).add_to(f)
    m = folium.Map().add_to(c)
    g = crossfolium.FeatureGroupFilter(c).add_to(m)
    crossfolium.marker_function.CircleMarkerFunction(
        radius=50000,
        radius_meter=True,
        stroke=False,
        fillColor='red',
        ).add_to(g)
    crossfolium.marker_function.CircleMarkerFunction(
        radius=10,
        radius_meter=False,
        weight=1,
        fillColor='green',
        ).add_to(g)
github woj-ciech / kamerka / kamerka.py View on Github external
repeats.append(str_coordinates)


    if service == 'twitter':
        twitter_icon = "https://cdn2.iconfinder.com/data/icons/metro-uinvert-dock/256/Twitter_NEW.png"
        help = 0
        for photo, coords in results.items():
            icon = folium.features.CustomIcon(twitter_icon, icon_size=(35, 35))  # bug
            try:
                if coords in repeats:
                    if photo.startswith("https://"):
                        twitter_icon_green = "https://www.iconsdb.com/icons/preview/green/twitter-xxl.png"

                        icon = folium.features.CustomIcon(twitter_icon_green, icon_size=(35, 35))  # bug
                        html = '<img src="{}" style="width:100%; height:100%;">'.format(photo)
                        popup = folium.Popup(branca.element.IFrame(html=html, width=420, height=320), max_width=2137)

                        folium.Marker([coords[1], coords[0]], icon=icon,
                                      popup=popup).add_to(marker_cluster)
                    else:
                        test = folium.Html(photo, script=False)
                        popup = folium.Popup(test, max_width=2650)

                        folium.Marker([coords[1], coords[0]], icon=icon,
                                      popup=popup).add_to(marker_cluster)
                else:
                    if photo.startswith("https://"):
                        twitter_icon_green = "https://www.iconsdb.com/icons/preview/green/twitter-xxl.png"

                        icon = folium.features.CustomIcon(twitter_icon_green, icon_size=(35, 35))  # bug
                        html = '<img src="{}" style="width:100%; height:100%;">'.format(photo)
                        popup = folium.Popup(branca.element.IFrame(html=html, width=420, height=320), max_width=2137)
github woj-ciech / kamerka / kamerka.py View on Github external
if coordinates in repeats:
                    folium.Marker([camera['location']['latitude'], camera['location']['longitude']], icon=shodan_icon,
                                  popup=popup).add_to(marker_cluster)
                else:
                    folium.Marker([camera['location']['latitude'], camera['location']['longitude']], icon=shodan_icon,
                                  popup=popup,
                                  ).add_to(folium_map)

                repeats.append(coordinates)

    if service == 'instagram':
        insta_icon = "http://icons-for-free.com/free-icons/png/512/2329265.png"
        for photo, coordinates in results.items():
            icon = folium.features.CustomIcon(insta_icon, icon_size=(35, 35))  # bug
            html = '<img src="{}" style="width:100%; height:100%;">'.format(str(photo))
            popup = folium.Popup(branca.element.IFrame(html=html, width=420, height=320), max_width=2137)
            if coordinates in repeats:
                folium.Marker([coordinates[0], coordinates[1]], icon=icon,
                              popup=popup).add_to(marker_cluster)
            else:
                folium.Marker([coordinates[0], coordinates[1]], icon=icon,
                              popup=popup).add_to(folium_map)

            repeats.append(coordinates)

    if service == 'flickr':
        flickr_icon = "http://www.myiconfinder.com/uploads/iconsets/f425a318030877cc09cb7832bea3e2c8.png"
        for flickr_photo in results:
            icon = folium.features.CustomIcon(flickr_icon, icon_size=(35, 35))


            str_coordinates = str(flickr_photo['latitude']) + ',' + str(flickr_photo['longitude'])