Lab 7¶
This is a notebook with two parts. It showcases the two different classes of the basal_and_bark.py package. The first section showcases that functionality of the Folium_Map class built on folium and the second section showcases the functionality of the Map class, built on ipyleaflet.
Outputs have been suppressed for timely loading. Please open this notebook and explore the functionalities with outputs of different maps.
In [ ]:
Copied!
%pip install basal_and_bark
%pip install geopandas
%pip install basal_and_bark
%pip install geopandas
In [1]:
Copied!
import basal_and_bark
import basal_and_bark
In [2]:
Copied!
from basal_and_bark import basal_and_bark_folium as fol
from basal_and_bark import basal_and_bark as basal
from basal_and_bark import basal_and_bark_folium as fol
from basal_and_bark import basal_and_bark as basal
For ease of viewing, this will be the viewing area of most of the examples.
In [3]:
Copied!
import geopandas
f = geopandas.read_file("https://github.com/ZachDorm/basal_and_bark/raw/main/docs/examples/data/TIGER_Line_2018_Tennessee_Counties.geojson")
first = f.total_bounds[0]
second = f.total_bounds[1]
third = f.total_bounds[2]
fourth = f.total_bounds[3]
import geopandas
f = geopandas.read_file("https://github.com/ZachDorm/basal_and_bark/raw/main/docs/examples/data/TIGER_Line_2018_Tennessee_Counties.geojson")
first = f.total_bounds[0]
second = f.total_bounds[1]
third = f.total_bounds[2]
fourth = f.total_bounds[3]
Map_Folium Class¶
In [4]:
Copied!
folium_map = fol.Map_Folium(location = [40,-100], tiles="Stamen Terrain", zoom_start=13)
folium_map = fol.Map_Folium(location = [40,-100], tiles="Stamen Terrain", zoom_start=13)
Add GeoJSON to Map_Folium object
In [5]:
Copied!
folium_map.add_geojson_folium("https://github.com/ZachDorm/basal_and_bark/raw/main/docs/examples/data/TIGER_Line_2018_Tennessee_Counties.geojson")
folium_map.add_geojson_folium("https://github.com/ZachDorm/basal_and_bark/raw/main/docs/examples/data/TIGER_Line_2018_Tennessee_Counties.geojson")
Out[5]:
<folium.features.GeoJson at 0x18db9381180>
In [6]:
Copied!
folium_map.fit_bounds([[second, third], [fourth, first]])
folium_map
folium_map.fit_bounds([[second, third], [fourth, first]])
folium_map
Out[6]:
Make this Notebook Trusted to load map: File -> Trust Notebook