This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gpd | |
import matplotlib.pyplot as plt | |
import contextily as ctx | |
gdf = gpd.read_file('my_population_data.gpkg') | |
fig, ax = plt.subplots(figsize=(10, 10)) | |
gdf.plot( | |
ax=ax, | |
column='population', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import geopandas as gpd | |
import matplotlib.pyplot as plt | |
master_gdf = gpd.read_file('master_gdf.gpkg').to_crs('EPSG:4326') # make sure both gdf are in same CRS | |
clip_zone_gdf = gpd.read_file('clipping_shapefile.gpkg').to_crs('EPSG:4326') | |
clip_union = clip_zone_gdf.unary_union | |
master_gdf_clipped = master_gdf[master_gdf.geometry.within(clip_union)] | |
master_gdf_clipped.to_file("master_gdf_clipped.gpkg",driver='GPKG') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Download free Springer ebooks. | |
Examples: | |
python fetch_springer_ebooks python | |
python fetch_springer_ebooks --dest my/ebooks math | |
python fetch_springer_ebooks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import re | |
def file_finder(directory_path:str, | |
specific_string_list:list) -> list: | |
all_files = os.listdir(directory_path) | |
all_txt = [file for file in all_files if file.endswith(".txt")] | |
pattern = re.compile(f"""{"|".join(re.escape(item) for item in specific_string_list)}""") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import geopandas as gpd | |
from fiona.drvsupport import supported_drivers | |
def kml_file_reader(kml_filepath:str) -> gpd.GeoDataFrame: | |
kml_data = gpd.read_file(kml_filepath, driver = 'LIBKML') \ | |
if os.path.exists(kml_filepath) \ | |
else print ("***KML file at provided path does not exists***") | |