Já používám tento dataset: https://sedac.ciesin.columbia.edu/data/set/gpw-v4-population-density-rev11/data-download (Mřížkované hustota obyvatelstva světa)
Pomocí této mapy: https://data.humdata.org/dataset/uganda-administrative-boundaries-as-of-17-08-2018 (Uganda administrativní hranice shapefile)
Mám připnutý ugandě mapa regionu potřebuju, tak jako:
shape_records = uganda.shapeRecords()
desired_shapes = []
for s in shape_records:
for x in s.record:
if 'FORT PORTAL' in str(x):
desired_shapes.append(s)
Naložili je do jednoho geopandas datovém:
forgpd=[]
for x in desired_shapes:
forgpd.append(x.__geo_interface__)
gdf = gpd.GeoDataFrame.from_features(forgpd, crs=4326)
Pak čtu .tif
světová populace se souboru s rasterio
.
gpw = rio.open('UgandaData/gpw_v4_population_density_rev11_2020_30_sec.tif')
gpw_region = gpw.read(1, window=gpw.window(*box))
A já bych chtěl oříznout, pomocí tohoto:
from rasterio import mask as msk
region_mask, region_mask_tf = msk.mask(dataset=gpw, shapes=gdf.geometry, all_touched=True, filled=True, crop=True) #error here
region_mask = np.where(region_mask < 0, 0, region_mask).squeeze()
Mám následující chyby:
WindowError: windows do not intersect
ValueError: Input shapes do not overlap raster.
Tohle je můj crs:
Gridded population of world: CRS.from_epsg(4326)
Uganda(Fort Portal) :
<Geographic 2D CRS: EPSG:4326>
Name: WGS 84
Axis Info [ellipsoidal]:
- Lat[north]: Geodetic latitude (degree)
- Lon[east]: Geodetic longitude (degree)
Area of Use:
- name: World
- bounds: (-180.0, -90.0, 180.0, 90.0)
Datum: World Geodetic System 1984
- Ellipsoid: WGS 84
- Prime Meridian: Greenwich
Mohl rozdíl být, že jsem se neuvádějí WGS 84 pro mřížkované světové populace? Pokud ano, jak je to uvedeno?