All examples By author By category About

wrobstory

Folium Markers with Lat/Lng Popovers

A custom Mapbox map generated by Folium. One fixed marker, one fixed circle marker. Click on the map to place a new marker, click the marker to see Lat/Lng, double-click the marker to remove it. This map was generated with the following Python code:

import folium

#Custom Mapbox Tiles
tileset = r'http://a.tiles.mapbox.com/v3/[...]/{z}/{x}/{y}.png'
attribution = (r'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a>'
                ' contributors, Imagery © <a href="http://mapbox.com">MapBox</a>')
#Create Map
mapbox = folium.Map(location=[45.5236, -122.6750], tiles=tileset, zoom_start=13,
                    attr=attribution)
#Add a simple marker and a circle
mapbox.simple_marker(location=[45.5244, -122.6699], popup_txt='The Waterfront')
mapbox.circle_marker(location=[45.5215, -122.6261], radius=300, 
                     popup_txt='Laurelhurst Park', line_color='#9cc6a5',
                     fill_color='#9cc6a5')
#Enable marker placement
mapbox.click_for_marker()
mapbox.create_map(path='index.html')