torchgeo
torchgeo copied to clipboard
GeoDataset: add support for slicing
This PR adds support for GeoDataset slicing, and is part of ongoing work to add time series support to TorchGeo: #2382.
Before
ds[BoundingBox(xmin, xmax, ymin, ymax, tmin, tmax)]
After
ds[xmin:xmax, ymin:ymax]
ds[:, :, tmin:tmax]
ds[xmin:xmax:xres, ymin:ymax:yres, tmin:tmax:tres]
Progress
- [x] Dataset Base Classes
- [x] GeoDataset
- [x] RasterDataset
- [x] VectorDataset
- [x] IntersectionDataset
- [x] UnionDataset
- [x] Custom Datasets
- [x] AgriFieldNet
- [x] Chesapeake CVPR
- [x] EDDMapS
- [x] EnviroAtlas
- [x] GBIF
- [x] GlobBiomass
- [x] iNaturalist
- [x] LandCover.ai
- [x] Open Buildings
- [x] South Africa Crop Type
- [x] Samplers
- [x] GeoSampler
- [x] RandomGeoSampler
- [x] GridGeoSampler
- [x] PreChippedGeoSampler
- [x] BatchGeoSampler
- [x] RandomBatchGeoSampler
- [x] Documentation
- [x] Testing
Backwards-Incompatible Changes
- GeoDatasets are now indexed by GeoSlice, not BoundingBox
- GeoDataset.bounds now returns a GeoSlice, not BoundingBox
- Returned sample bounds are now a GeoSlice, not BoundingBox
- get_random_bounding_box now takes a tuple as input and returns a tuple
- tile_to_chips now takes a tuple as input