Created
June 21, 2023 10:21
-
-
Save grinsted/623b6c44b26ba0f02a93aa0e54cdf285 to your computer and use it in GitHub Desktop.
This file contains 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 numpy as np | |
import pandas as pd | |
import geopandas as gpd | |
from shapely.geometry import Point, Polygon | |
zwally = np.loadtxt('grndrainagesystems_ekholm.txt',skiprows=7) | |
regions = np.unique(zwally[:,0]) | |
for region in regions: | |
z = zwally[np.abs(zwally[:,0]-region)<0.001,1:] | |
#p = gpd.GeoSeries(map(Point, zip(z[:,1], z[:,0])),crs = 'EPSG:4326') | |
p = gpd.GeoSeries([Polygon(np.fliplr(z))],crs = 'EPSG:4326') | |
p = p.to_crs('epsg:3413') | |
p.to_file("zwallybasins.gpkg", layer=f'{region:.1f}', driver="GPKG") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment