How to use the folium.RegularPolygonMarker function in folium

To help you get started, we’ve selected a few folium 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 bukun / book_python_gis / part010 / ch09_others / sec5_folium / test_1_basic_x_x.py View on Github external
###############################################################################
map7 = folium.Map(location=[43.92, 125.34],
    tiles='Stamen Terrain', zoom_start=13)
folium.LatLngPopup().add_to(map7)
map7.save('folium_7.html')
###############################################################################
map8 = folium.Map(location=[43.92, 125.34],
    tiles='Stamen Terrain', zoom_start=12)
folium.Marker([43.8520, 125.3070],
    popup='长春南湖').add_to(map8)
folium.ClickForMarker(popup='Waypoint').add_to(map8)
map8.save('folium_8.html')
###############################################################################
map9 = folium.Map(location=[43.92, 125.34], zoom_start=12,
    tiles='Stamen Terrain')
folium.RegularPolygonMarker([43.8520, 125.3070],
    popup='长春南湖', fill_color='#ff00ff',
    number_of_sides=4).add_to(map9)
folium.RegularPolygonMarker([43.9830, 125.3561],
    popup='长春北湖湿地公园', fill_color='#769d96',
    number_of_sides=6, radius=20).add_to(map9)
map9.save('folium_9.html')
github bukun / book_python_gis / part010 / ch09_others / sec5_folium / test_2_data_x_x.py View on Github external
fill_color='#ff0000', radius=12, popup=popup1
    ).add_to(map_a)
###############################################################################
popup2 = folium.Popup(max_width=800,).add_child(
    folium.Vega(
        json.load(open('/gdata/folium/data/vis2.json')),
        width=500, height=250))
folium.RegularPolygonMarker([44.639, -124.5339],
    fill_color='#00ff00', radius=12, popup=popup2
    ).add_to(map_a)
###############################################################################
popup3 = folium.Popup(max_width=800,).add_child(
    folium.Vega(
        json.load(open('/gdata/folium/data/vis3.json')),
        width=500, height=250))
folium.RegularPolygonMarker([46.216, -124.1280],
    fill_color='#0000ff', radius=12, popup=popup3
    ).add_to(map_a)
map_a.save('folium_a.html')
###############################################################################
ice_edge = '/gdata/folium/data/antarctic_ice_edge.json'
map_b = folium.Map(
    location=[-59.1759, -11.6016],
    tiles='Mapbox Bright',
    zoom_start=2
)
folium.GeoJson(ice_edge, name='geojson').add_to(map_b)
###############################################################################
icej='/gdata/folium/data/antarctic_ice_shelf_topo.json'
folium.TopoJson(open(icej),
    'objects.antarctic_ice_shelf',
    name='topojson'
github python-visualization / folium / tests / test_features.py View on Github external
def test_marker_popups():
    m = Map()
    folium.Marker([45, -180], popup='-180').add_to(m)
    folium.Marker([45, -120], popup=Popup('-120')).add_to(m)
    folium.RegularPolygonMarker([45, -60], popup='-60').add_to(m)
    folium.RegularPolygonMarker([45, 0], popup=Popup('0')).add_to(m)
    folium.CircleMarker([45, 60], popup='60').add_to(m)
    folium.CircleMarker([45, 120], popup=Popup('120')).add_to(m)
    folium.CircleMarker([45, 90], popup=Popup('90'), weight=0).add_to(m)
    m._repr_html_()

    bounds = m.get_bounds()
    assert bounds == [[45, -180], [45, 120]], bounds
github python-visualization / folium / tests / test_features.py View on Github external
def test_marker_popups():
    m = Map()
    folium.Marker([45, -180], popup='-180').add_to(m)
    folium.Marker([45, -120], popup=Popup('-120')).add_to(m)
    folium.RegularPolygonMarker([45, -60], popup='-60').add_to(m)
    folium.RegularPolygonMarker([45, 0], popup=Popup('0')).add_to(m)
    folium.CircleMarker([45, 60], popup='60').add_to(m)
    folium.CircleMarker([45, 120], popup=Popup('120')).add_to(m)
    folium.CircleMarker([45, 90], popup=Popup('90'), weight=0).add_to(m)
    m._repr_html_()

    bounds = m.get_bounds()
    assert bounds == [[45, -180], [45, 120]], bounds
github ROBelgium / MSNoise / msnoise / plots / station_map.py View on Github external
def main(show=True, outfile=None):
    db = connect()
    stations = get_stations(db, all=False)
    coords = [(sta.Y, sta.X) for sta in stations]
    coords = np.array(coords)

    sta_map = folium.Map(location=[np.mean(coords[:, 0]),
                                   np.mean(coords[:, 1])],
                         zoom_start=3, tiles='OpenStreetMap')
    folium.RegularPolygonMarker(location=[np.mean(coords[:, 1]),
                                          np.mean(coords[:, 0])]).\
        add_to(sta_map)
    for sta in stations:
        folium.RegularPolygonMarker(location=[sta.Y, sta.X],
                                    popup="%s_%s" % (sta.net, sta.sta),
                                    fill_color='red',
                                    number_of_sides=3,
                                    radius=12).add_to(sta_map)

    sta_map.add_child(folium.LatLngPopup())
    if outfile:
        tmp = outfile
        if outfile.startswith("?"):
            now = datetime.datetime.now()
            now = now.strftime('station map on %Y-%m-%d %H.%M.%S')
            tmp = outfile.replace('?', now)
github ROBelgium / MSNoise / msnoise / plots / station_map.py View on Github external
def main(show=True, outfile=None):
    db = connect()
    stations = get_stations(db, all=False)
    coords = [(sta.Y, sta.X) for sta in stations]
    coords = np.array(coords)

    sta_map = folium.Map(location=[np.mean(coords[:, 0]),
                                   np.mean(coords[:, 1])],
                         zoom_start=3, tiles='OpenStreetMap')
    folium.RegularPolygonMarker(location=[np.mean(coords[:, 1]),
                                          np.mean(coords[:, 0])]).\
        add_to(sta_map)
    for sta in stations:
        folium.RegularPolygonMarker(location=[sta.Y, sta.X],
                                    popup="%s_%s" % (sta.net, sta.sta),
                                    fill_color='red',
                                    number_of_sides=3,
                                    radius=12).add_to(sta_map)

    sta_map.add_child(folium.LatLngPopup())
    if outfile:
        tmp = outfile
        if outfile.startswith("?"):
            now = datetime.datetime.now()
            now = now.strftime('station map on %Y-%m-%d %H.%M.%S')
            tmp = outfile.replace('?', now)
        logging.debug("output to:", tmp)
        sta_map.save('%s.html' % tmp)

    # plot topography/bathymetry as an image.
github scikit-mobility / scikit-mobility / skmob / utils / plot.py View on Github external
for idx, row in df.iterrows():

            la = row[constants.LATITUDE]
            lo = row[constants.LONGITUDE]
            t0 = row[constants.DATETIME]
            t1 = row[constants.LEAVING_DATETIME]
            u = user
            try:
                ncluster = row[constants.CLUSTER]
                cl = '<br>Cluster: {}'.format(ncluster)
                color = get_color(ncluster)
            except (KeyError, NameError):
                cl = ''

            fpoly = folium.RegularPolygonMarker([la, lo],
                                        radius=radius,
                                        color=color,
                                        fill_color=color,
                                        fill_opacity=opacity
                                        )
            if popup:
                popup = folium.Popup('User: {}<br>Coord: <a href="https://www.google.co.uk/maps/place/{},{}">{}, {}</a><br>Arr: {}<br>Dep: {}{}' \
                    .format(u, la, lo, np.round(la, 4), np.round(lo, 4),
                            pd.datetime.strftime(t0, '%Y/%m/%d %H:%M'),
                            pd.datetime.strftime(t1, '%Y/%m/%d %H:%M'), cl), max_width=300)
                fpoly = fpoly.add_child(popup)

            fpoly.add_to(map_f)

    return map_f