#Import the Module Folium
import folium
#Gather all the data you want to use
url = (
"https://raw.githubusercontent.com/jwitcoski/jwitcoski.github.io/master/Antikythera/data/"
)
tracts = f"{url}""tracts.geojson"
geology = f"{url}""geology.geojson"
#Define the map's location and zoom level
map = folium.Map(
location=[35.8644, 23.2988],
zoom_start=13,
)
#add some basemaps
folium.raster_layers.TileLayer(
tiles='OpenStreetMap', name='Open Street Map'
).add_to(map)
folium.raster_layers.TileLayer(
tiles='stamentoner', name='Black/White Map'
).add_to(map)
folium.raster_layers.TileLayer(
tiles='stamenterrain', name='stamenterrain'
).add_to(map)
folium.raster_layers.TileLayer(
tiles='CartoDB dark_matter', name='CartoDB dark_matter'
).add_to(map)
<folium.raster_layers.TileLayer at 0x2378d1eaf98>
#give the layers some color
def style_function(self):
return {'fillColor': 'black'};
def style_function2(self):
return {'fillColor': 'green', "opacity": 0.99}
#Insert the layers into the map, Give them tool tips and names we can recognize
folium.GeoJson(geology,tooltip= folium.GeoJsonTooltip(fields=["Type","Age"]), name="geology", style_function=style_function).add_to(map)
folium.GeoJson(tracts, tooltip= folium.GeoJsonTooltip(fields=["Tract","Comments"]), name="tracts", style_function=style_function2, show = False).add_to(map)
<folium.features.GeoJson at 0x2378d285630>
#Add the layer control so that the user can turn on and off layers
folium.LayerControl().add_to(map)
<folium.map.LayerControl at 0x2378d1ff780>
#Create the map
map
#Export the map as HTML
map.save("fuliummap.html")