For those wanting to test the contents of their .geojson
files, by visualising/ plotting coordinates
.
I didn't see a go-to solution online.
CodePudding user response:
Solution
import os
from pathlib import Path
import geopandas as gpd
import matplotlib.pyplot as plt
def main(root: Path):
root = str(root)
filenames = os.listdir(root)
geojson_filenames = list(filter(lambda f: f.endswith('.geojson'), filenames))
for gjf in geojson_filenames:
df = gpd.read_file(f'{root}/{gjf}')
df.plot(aspect=1)
plt.get_current_fig_manager().canvas.set_window_title(gjf)
plt.show()
if __name__ == '__main__':
ROOT = Path('some/path/)
main(ROOT)
Feel free to critique or suggest improvements.