I tried running the following modified version of the provided example. The paths are slightly different from what is in the main repo:
basedir = 'test_input'
band1 = os.path.join(basedir, 'nc_dataset', 'lsat7_2000_10.tif')
band2 = os.path.join(basedir, 'nc_dataset', 'lsat7_2000_20.tif')
band3 = os.path.join(basedir, 'nc_dataset', 'lsat7_2000_30.tif')
band4 = os.path.join(basedir, 'nc_dataset', 'lsat7_2000_40.tif')
band5 = os.path.join(basedir, 'nc_dataset', 'lsat7_2000_50.tif')
band7 = os.path.join(basedir, 'nc_dataset', 'lsat7_2000_70.tif')
predictors = [band1, band2, band3, band4, band5, band7]
# Create a RasterStack instance
stack = pyspatialml.Raster([band1, band2, band3, band4, band5, band7])
stack.count
stack_rs = stack.to_crs(crs={'init': 'EPSG:4326'}, progress=False)
# Aggregate a raster to a coarser cell size
stack_new = stack.aggregate(out_shape=(100, 100))
# Load some training data in the form of a shapefile of point feature locations:
training_py = geopandas.read_file(os.path.join(basedir, 'nc_dataset', 'landsat96_polygons.shp'))
df_polygons = stack.extract_vector(response=training_py, field='id')
df_polygons.crs = df_polygons.crs.to_string()
df_polygons.to_file('test_intermediate\\test.geojson', driver='GeoJSON')
In the last line I attempt to write the extracted polygons to a physical file. I notice from the source code that the extracted polygons take the CRS of the defined raster stack. However when I plot them on QGIS I see that the extracted vectors are drawn on a completely different part of the map and seem to extract cells which are not analogous to the original polygon layer....
I tried running the following modified version of the provided example. The paths are slightly different from what is in the main repo:
In the last line I attempt to write the extracted polygons to a physical file. I notice from the source code that the extracted polygons take the CRS of the defined raster stack. However when I plot them on QGIS I see that the extracted vectors are drawn on a completely different part of the map and seem to extract cells which are not analogous to the original polygon layer....
Am I doing something wrong? Please help.