In this PR we implement Raster.label which allows the user to use a configuration .json specifying how to newly label images from geometric datasets:
def label(
self: Raster,
config: str | Path | dict,
outdir: str | Path = None,
) -> Series[str]:
"""
"Annotate," "mask," or "label" the tiles with ground truth data;
generate new images from external sources to train the model.
Parameters
----------
self : Raster
The raster which defines the tiles to be labeled
config : str | dict
a dict or path to .json containing the configuration metadata, for example:
config = {
'road': {
'path': rd,
'usecols': ['geometry', 'TYPE'],
'col': {'TYPE': ['RD-ALLEY', 'RD-UNPAVED', 'RD-PAVED']},
'color': 'green',
'order': 16
}
}
```
outdir : str | Path
the directory to save the labeled images to
Returns
-------
Series[str]
a series of paths to the labeled images, where the index
is the idd of the tile
"""
Here, `path` can be a path to local geometry, a url to a remote file to be saved to the temp directory, or a `GeoDataFrame` object.
Here is the output file for slippy tile `y=96957, x=79302, zoom=18`, and adjacent is from [slippy tile explorer.](https://chrishewett.com/blog/slippy-tile-explorer/)
![96957_79302_7](https://github.com/VIDA-NYU/tile2net/assets/60762400/b9a087d2-c900-4381-90eb-eb41614d2e9b)
![Screenshot_20240208_233908](https://github.com/VIDA-NYU/tile2net/assets/60762400/6a188817-ec60-454f-857b-b8930919a0ae)
`tile2net/misc` was deleted because it was unused, outdated `magicpandas` resources floating around
In this PR we implement
Raster.label
which allows the user to use a configuration .json specifying how to newly label images from geometric datasets: