In [87]:
pip install geopandas folium rasterio
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: geopandas in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (0.10.2)
Requirement already satisfied: folium in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (0.12.1.post1)
Requirement already satisfied: rasterio in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (1.2.8)
Requirement already satisfied: pyproj>=2.2.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (3.3.0)
Requirement already satisfied: pandas>=0.25.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (1.3.5)
Requirement already satisfied: shapely>=1.6 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (1.8.0)
Requirement already satisfied: fiona>=1.8 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (1.8.20)
Requirement already satisfied: numpy in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (1.22.0)
Requirement already satisfied: jinja2>=2.9 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (3.0.3)
Requirement already satisfied: requests in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (2.27.1)
Requirement already satisfied: branca>=0.3.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (0.4.2)
Requirement already satisfied: click>=4.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (7.1.2)
Requirement already satisfied: setuptools in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (59.8.0)
Requirement already satisfied: affine in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (2.3.0)
Requirement already satisfied: attrs in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (21.4.0)
Requirement already satisfied: click-plugins in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (1.1.1)
Requirement already satisfied: cligj>=0.5 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (0.7.2)
Requirement already satisfied: snuggs>=1.4.1 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (1.4.7)
Requirement already satisfied: certifi in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from rasterio) (2021.10.8)
Requirement already satisfied: six>=1.7 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (1.16.0)
Requirement already satisfied: munch in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (2.5.0)
Requirement already satisfied: MarkupSafe>=2.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from jinja2>=2.9->folium) (2.0.1)
Requirement already satisfied: python-dateutil>=2.7.3 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from pandas>=0.25.0->geopandas) (2.8.0)
Requirement already satisfied: pytz>=2017.3 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from pandas>=0.25.0->geopandas) (2021.3)
Requirement already satisfied: pyparsing>=2.1.6 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from snuggs>=1.4.1->rasterio) (3.0.7)
Requirement already satisfied: charset-normalizer~=2.0.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from requests->folium) (2.0.10)
Requirement already satisfied: idna<4,>=2.5 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from requests->folium) (3.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from requests->folium) (1.25.11)
Note: you may need to restart the kernel to use updated packages.
In [93]:
pip install folium geopandas
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: folium in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (0.12.1.post1)
Requirement already satisfied: geopandas in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (0.10.2)
Requirement already satisfied: requests in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (2.27.1)
Requirement already satisfied: jinja2>=2.9 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (3.0.3)
Requirement already satisfied: numpy in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (1.22.0)
Requirement already satisfied: branca>=0.3.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from folium) (0.4.2)
Requirement already satisfied: shapely>=1.6 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (1.8.0)
Requirement already satisfied: fiona>=1.8 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (1.8.20)
Requirement already satisfied: pyproj>=2.2.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (3.3.0)
Requirement already satisfied: pandas>=0.25.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from geopandas) (1.3.5)
Requirement already satisfied: attrs>=17 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (21.4.0)
Requirement already satisfied: certifi in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (2021.10.8)
Requirement already satisfied: click>=4.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (7.1.2)
Requirement already satisfied: cligj>=0.5 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (0.7.2)
Requirement already satisfied: click-plugins>=1.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (1.1.1)
Requirement already satisfied: six>=1.7 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (1.16.0)
Requirement already satisfied: munch in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (2.5.0)
Requirement already satisfied: setuptools in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from fiona>=1.8->geopandas) (59.8.0)
Requirement already satisfied: MarkupSafe>=2.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from jinja2>=2.9->folium) (2.0.1)
Requirement already satisfied: python-dateutil>=2.7.3 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from pandas>=0.25.0->geopandas) (2.8.0)
Requirement already satisfied: pytz>=2017.3 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from pandas>=0.25.0->geopandas) (2021.3)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from requests->folium) (1.25.11)
Requirement already satisfied: charset-normalizer~=2.0.0 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from requests->folium) (2.0.10)
Requirement already satisfied: idna<4,>=2.5 in /cvmfs/cybergis.illinois.edu/software/conda/cybergisx/python3-0.9.0/lib/python3.8/site-packages (from requests->folium) (3.3)
Note: you may need to restart the kernel to use updated packages.
In [94]:
import folium
import geopandas as gpd
In [98]:
#Watershed & Subwatershed
shapefile_path = "WBDHU12.shp" #This contains the boundaries of the watershed 8 - 14080105 and its subwatersheds
gdf = gpd.read_file(shapefile_path)
In [108]:
geojson_data = gdf.__geo_interface__  #GeoDataFrame data to GeoJSON data
m = folium.Map(location=[36.9990, -109.0452], zoom_start=7) #make a folium map centered in the Southwest
In [109]:
#Add the overlay to the folium map
folium.GeoJson(
    geojson_data,
    name="My Shapefile Overlay"
).add_to(m)
Out[109]:
<folium.features.GeoJson at 0x7f6945b47070>
In [110]:
m.save("shapefile_map.html") #make it an html file that we can see on the web
In [ ]:
 
In [ ]: