Skip to content

rslearn.tile_stores.tile_store

tile_store

Base class for tile stores.

TileStore

An abstract class for a tile store.

A tile store supports operations to read and write raster and vector data.

Source code in rslearn/tile_stores/tile_store.py
class TileStore:
    """An abstract class for a tile store.

    A tile store supports operations to read and write raster and vector data.
    """

    def set_dataset_path(self, ds_path: UPath) -> None:
        """Set the dataset path.

        This is in case the TileStore wants to use the ds_path to help determine where
        to store data.

        Args:
            ds_path: the dataset path that this TileStore is a part of.
        """
        pass

    def is_raster_ready(self, layer_name: str, item: Item, bands: list[str]) -> bool:
        """Checks if this raster has been written to the store.

        Args:
            layer_name: the layer name or alias.
            item: the item.
            bands: the list of bands identifying which specific raster to read.

        Returns:
            whether there is a raster in the store matching the source, item, and
                bands.
        """
        raise NotImplementedError

    def get_raster_bands(self, layer_name: str, item: Item) -> list[list[str]]:
        """Get the sets of bands that have been stored for the specified item.

        Args:
            layer_name: the layer name or alias.
            item: the item.

        Returns:
            a list of lists of bands that are in the tile store (with one raster
                stored corresponding to each inner list). If no rasters are ready for
                this item, returns empty list.
        """
        raise NotImplementedError

    def get_raster_bounds(
        self, layer_name: str, item: Item, bands: list[str], projection: Projection
    ) -> PixelBounds:
        """Get the bounds of the raster in the specified projection.

        Args:
            layer_name: the layer name or alias.
            item: the item to check.
            bands: the list of bands identifying which specific raster to read. These
                bands must match the bands of a stored raster.
            projection: the projection to get the raster's bounds in.

        Returns:
            the bounds of the raster in the projection.
        """
        raise NotImplementedError

    def get_raster_metadata(
        self, layer_name: str, item: Item, bands: list[str]
    ) -> RasterMetadata:
        """Get metadata for a stored raster without reading pixel data.

        Args:
            layer_name: the layer name or alias.
            item: the item.
            bands: the list of bands identifying which specific raster to read.

        Returns:
            a RasterMetadata instance (may have None fields if the store
            does not track a given piece of metadata).
        """
        raise NotImplementedError

    def read_raster(
        self,
        layer_name: str,
        item: Item,
        bands: list[str],
        projection: Projection,
        bounds: PixelBounds,
        resampling: Resampling = Resampling.bilinear,
    ) -> RasterArray:
        """Read raster data from the store.

        Args:
            layer_name: the layer name or alias.
            item: the item to read.
            bands: the list of bands identifying which specific raster to read. These
                bands must match the bands of a stored raster.
            projection: the projection to read in.
            bounds: the bounds to read.
            resampling: the resampling method to use in case reprojection is needed.

        Returns:
            the raster data
        """
        raise NotImplementedError

    def write_raster(
        self,
        layer_name: str,
        item: Item,
        bands: list[str],
        projection: Projection,
        bounds: PixelBounds,
        raster: RasterArray,
    ) -> None:
        """Write raster data to the store.

        Args:
            layer_name: the layer name or alias.
            item: the item to write.
            bands: the list of bands in the array.
            projection: the projection of the array.
            bounds: the bounds of the array.
            raster: the raster data.
        """
        raise NotImplementedError

    def write_raster_file(
        self,
        layer_name: str,
        item: Item,
        bands: list[str],
        fname: UPath,
        time_range: tuple[datetime, datetime] | None = None,
    ) -> None:
        """Write raster data to the store.

        Args:
            layer_name: the layer name or alias.
            item: the item to write.
            bands: the list of bands in the array.
            fname: the raster file.
            time_range: optional time range for the raster.
        """
        raise NotImplementedError

    def is_vector_ready(self, layer_name: str, item: Item) -> bool:
        """Checks if this vector item has been written to the store.

        Args:
            layer_name: the layer name or alias.
            item: the item.

        Returns:
            whether the vector data from the item has been stored.
        """
        raise NotImplementedError

    def read_vector(
        self,
        layer_name: str,
        item: Item,
        projection: Projection,
        bounds: PixelBounds,
    ) -> list[Feature]:
        """Read vector data from the store.

        Args:
            layer_name: the layer name or alias.
            item: the item to read.
            projection: the projection to read in.
            bounds: the bounds within which to read.

        Returns:
            the vector data
        """
        raise NotImplementedError

    def write_vector(
        self, layer_name: str, item: Item, features: list[Feature]
    ) -> None:
        """Write vector data to the store.

        Args:
            layer_name: the layer name or alias.
            item: the item to write.
            features: the vector data.
        """
        raise NotImplementedError

set_dataset_path

set_dataset_path(ds_path: UPath) -> None

Set the dataset path.

This is in case the TileStore wants to use the ds_path to help determine where to store data.

Parameters:

Name Type Description Default
ds_path UPath

the dataset path that this TileStore is a part of.

required
Source code in rslearn/tile_stores/tile_store.py
def set_dataset_path(self, ds_path: UPath) -> None:
    """Set the dataset path.

    This is in case the TileStore wants to use the ds_path to help determine where
    to store data.

    Args:
        ds_path: the dataset path that this TileStore is a part of.
    """
    pass

is_raster_ready

is_raster_ready(layer_name: str, item: Item, bands: list[str]) -> bool

Checks if this raster has been written to the store.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item.

required
bands list[str]

the list of bands identifying which specific raster to read.

required

Returns:

Type Description
bool

whether there is a raster in the store matching the source, item, and bands.

Source code in rslearn/tile_stores/tile_store.py
def is_raster_ready(self, layer_name: str, item: Item, bands: list[str]) -> bool:
    """Checks if this raster has been written to the store.

    Args:
        layer_name: the layer name or alias.
        item: the item.
        bands: the list of bands identifying which specific raster to read.

    Returns:
        whether there is a raster in the store matching the source, item, and
            bands.
    """
    raise NotImplementedError

get_raster_bands

get_raster_bands(layer_name: str, item: Item) -> list[list[str]]

Get the sets of bands that have been stored for the specified item.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item.

required

Returns:

Type Description
list[list[str]]

a list of lists of bands that are in the tile store (with one raster stored corresponding to each inner list). If no rasters are ready for this item, returns empty list.

Source code in rslearn/tile_stores/tile_store.py
def get_raster_bands(self, layer_name: str, item: Item) -> list[list[str]]:
    """Get the sets of bands that have been stored for the specified item.

    Args:
        layer_name: the layer name or alias.
        item: the item.

    Returns:
        a list of lists of bands that are in the tile store (with one raster
            stored corresponding to each inner list). If no rasters are ready for
            this item, returns empty list.
    """
    raise NotImplementedError

get_raster_bounds

get_raster_bounds(layer_name: str, item: Item, bands: list[str], projection: Projection) -> PixelBounds

Get the bounds of the raster in the specified projection.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item to check.

required
bands list[str]

the list of bands identifying which specific raster to read. These bands must match the bands of a stored raster.

required
projection Projection

the projection to get the raster's bounds in.

required

Returns:

Type Description
PixelBounds

the bounds of the raster in the projection.

Source code in rslearn/tile_stores/tile_store.py
def get_raster_bounds(
    self, layer_name: str, item: Item, bands: list[str], projection: Projection
) -> PixelBounds:
    """Get the bounds of the raster in the specified projection.

    Args:
        layer_name: the layer name or alias.
        item: the item to check.
        bands: the list of bands identifying which specific raster to read. These
            bands must match the bands of a stored raster.
        projection: the projection to get the raster's bounds in.

    Returns:
        the bounds of the raster in the projection.
    """
    raise NotImplementedError

get_raster_metadata

get_raster_metadata(layer_name: str, item: Item, bands: list[str]) -> RasterMetadata

Get metadata for a stored raster without reading pixel data.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item.

required
bands list[str]

the list of bands identifying which specific raster to read.

required

Returns:

Type Description
RasterMetadata

a RasterMetadata instance (may have None fields if the store

RasterMetadata

does not track a given piece of metadata).

Source code in rslearn/tile_stores/tile_store.py
def get_raster_metadata(
    self, layer_name: str, item: Item, bands: list[str]
) -> RasterMetadata:
    """Get metadata for a stored raster without reading pixel data.

    Args:
        layer_name: the layer name or alias.
        item: the item.
        bands: the list of bands identifying which specific raster to read.

    Returns:
        a RasterMetadata instance (may have None fields if the store
        does not track a given piece of metadata).
    """
    raise NotImplementedError

read_raster

read_raster(layer_name: str, item: Item, bands: list[str], projection: Projection, bounds: PixelBounds, resampling: Resampling = bilinear) -> RasterArray

Read raster data from the store.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item to read.

required
bands list[str]

the list of bands identifying which specific raster to read. These bands must match the bands of a stored raster.

required
projection Projection

the projection to read in.

required
bounds PixelBounds

the bounds to read.

required
resampling Resampling

the resampling method to use in case reprojection is needed.

bilinear

Returns:

Type Description
RasterArray

the raster data

Source code in rslearn/tile_stores/tile_store.py
def read_raster(
    self,
    layer_name: str,
    item: Item,
    bands: list[str],
    projection: Projection,
    bounds: PixelBounds,
    resampling: Resampling = Resampling.bilinear,
) -> RasterArray:
    """Read raster data from the store.

    Args:
        layer_name: the layer name or alias.
        item: the item to read.
        bands: the list of bands identifying which specific raster to read. These
            bands must match the bands of a stored raster.
        projection: the projection to read in.
        bounds: the bounds to read.
        resampling: the resampling method to use in case reprojection is needed.

    Returns:
        the raster data
    """
    raise NotImplementedError

write_raster

write_raster(layer_name: str, item: Item, bands: list[str], projection: Projection, bounds: PixelBounds, raster: RasterArray) -> None

Write raster data to the store.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item to write.

required
bands list[str]

the list of bands in the array.

required
projection Projection

the projection of the array.

required
bounds PixelBounds

the bounds of the array.

required
raster RasterArray

the raster data.

required
Source code in rslearn/tile_stores/tile_store.py
def write_raster(
    self,
    layer_name: str,
    item: Item,
    bands: list[str],
    projection: Projection,
    bounds: PixelBounds,
    raster: RasterArray,
) -> None:
    """Write raster data to the store.

    Args:
        layer_name: the layer name or alias.
        item: the item to write.
        bands: the list of bands in the array.
        projection: the projection of the array.
        bounds: the bounds of the array.
        raster: the raster data.
    """
    raise NotImplementedError

write_raster_file

write_raster_file(layer_name: str, item: Item, bands: list[str], fname: UPath, time_range: tuple[datetime, datetime] | None = None) -> None

Write raster data to the store.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item to write.

required
bands list[str]

the list of bands in the array.

required
fname UPath

the raster file.

required
time_range tuple[datetime, datetime] | None

optional time range for the raster.

None
Source code in rslearn/tile_stores/tile_store.py
def write_raster_file(
    self,
    layer_name: str,
    item: Item,
    bands: list[str],
    fname: UPath,
    time_range: tuple[datetime, datetime] | None = None,
) -> None:
    """Write raster data to the store.

    Args:
        layer_name: the layer name or alias.
        item: the item to write.
        bands: the list of bands in the array.
        fname: the raster file.
        time_range: optional time range for the raster.
    """
    raise NotImplementedError

is_vector_ready

is_vector_ready(layer_name: str, item: Item) -> bool

Checks if this vector item has been written to the store.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item.

required

Returns:

Type Description
bool

whether the vector data from the item has been stored.

Source code in rslearn/tile_stores/tile_store.py
def is_vector_ready(self, layer_name: str, item: Item) -> bool:
    """Checks if this vector item has been written to the store.

    Args:
        layer_name: the layer name or alias.
        item: the item.

    Returns:
        whether the vector data from the item has been stored.
    """
    raise NotImplementedError

read_vector

read_vector(layer_name: str, item: Item, projection: Projection, bounds: PixelBounds) -> list[Feature]

Read vector data from the store.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item to read.

required
projection Projection

the projection to read in.

required
bounds PixelBounds

the bounds within which to read.

required

Returns:

Type Description
list[Feature]

the vector data

Source code in rslearn/tile_stores/tile_store.py
def read_vector(
    self,
    layer_name: str,
    item: Item,
    projection: Projection,
    bounds: PixelBounds,
) -> list[Feature]:
    """Read vector data from the store.

    Args:
        layer_name: the layer name or alias.
        item: the item to read.
        projection: the projection to read in.
        bounds: the bounds within which to read.

    Returns:
        the vector data
    """
    raise NotImplementedError

write_vector

write_vector(layer_name: str, item: Item, features: list[Feature]) -> None

Write vector data to the store.

Parameters:

Name Type Description Default
layer_name str

the layer name or alias.

required
item Item

the item to write.

required
features list[Feature]

the vector data.

required
Source code in rslearn/tile_stores/tile_store.py
def write_vector(
    self, layer_name: str, item: Item, features: list[Feature]
) -> None:
    """Write vector data to the store.

    Args:
        layer_name: the layer name or alias.
        item: the item to write.
        features: the vector data.
    """
    raise NotImplementedError

TileStoreWithLayer

Convenience class to access TileStore in the context of a layer.

Source code in rslearn/tile_stores/tile_store.py
class TileStoreWithLayer:
    """Convenience class to access TileStore in the context of a layer."""

    def __init__(self, tile_store: TileStore, layer_name: str):
        """Create a new TileStoreWithLayer.

        Args:
            tile_store: underlying TileStore.
            layer_name: the layer name.
        """
        self.tile_store = tile_store
        self.layer_name = layer_name

    def is_raster_ready(self, item: Item, bands: list[str]) -> bool:
        """Checks if this raster has been written to the store.

        Args:
            item: the item.
            bands: the list of bands identifying which specific raster to read.

        Returns:
            whether there is a raster in the store matching the source, item, and
                bands.
        """
        return self.tile_store.is_raster_ready(self.layer_name, item, bands)

    def get_raster_bands(self, item: Item) -> list[list[str]]:
        """Get the sets of bands that have been stored for the specified item.

        Args:
            item: the item.

        Returns:
            a list of lists of bands that are in the tile store (with one raster
                stored corresponding to each inner list). If no rasters are ready for
                this item, returns empty list.
        """
        return self.tile_store.get_raster_bands(self.layer_name, item)

    def get_raster_bounds(
        self, item: Item, bands: list[str], projection: Projection
    ) -> PixelBounds:
        """Get the bounds of the raster in the specified projection.

        Args:
            item: the item to check.
            bands: the list of bands identifying which specific raster to read. These
                bands must match the bands of a stored raster.
            projection: the projection to get the raster's bounds in.

        Returns:
            the bounds of the raster in the projection.
        """
        return self.tile_store.get_raster_bounds(
            self.layer_name, item, bands, projection
        )

    def get_raster_metadata(self, item: Item, bands: list[str]) -> RasterMetadata:
        """Get metadata for a stored raster without reading pixel data.

        Args:
            item: the item.
            bands: the list of bands identifying which specific raster to read.

        Returns:
            a RasterMetadata instance.
        """
        return self.tile_store.get_raster_metadata(self.layer_name, item, bands)

    def read_raster(
        self,
        item: Item,
        bands: list[str],
        projection: Projection,
        bounds: PixelBounds,
        resampling: Resampling = Resampling.bilinear,
    ) -> RasterArray:
        """Read raster data from the store.

        Args:
            item: the item to read.
            bands: the list of bands identifying which specific raster to read. These
                bands must match the bands of a stored raster.
            projection: the projection to read in.
            bounds: the bounds to read.
            resampling: the resampling method to use in case reprojection is needed.

        Returns:
            the raster data
        """
        return self.tile_store.read_raster(
            self.layer_name, item, bands, projection, bounds, resampling
        )

    def write_raster(
        self,
        item: Item,
        bands: list[str],
        projection: Projection,
        bounds: PixelBounds,
        raster: RasterArray,
    ) -> None:
        """Write raster data to the store.

        Args:
            item: the item to write.
            bands: the list of bands in the array.
            projection: the projection of the array.
            bounds: the bounds of the array.
            raster: the raster data.
        """
        self.tile_store.write_raster(
            self.layer_name, item, bands, projection, bounds, raster
        )

    def write_raster_file(
        self,
        item: Item,
        bands: list[str],
        fname: UPath,
        time_range: tuple[datetime, datetime] | None = None,
    ) -> None:
        """Write raster data to the store.

        Args:
            item: the item to write.
            bands: the list of bands in the array.
            fname: the raster file.
            time_range: optional time range for the raster.
        """
        self.tile_store.write_raster_file(
            self.layer_name, item, bands, fname, time_range=time_range
        )

    def is_vector_ready(self, item: Item) -> bool:
        """Checks if this vector item has been written to the store.

        Args:
            item: the item.

        Returns:
            whether the vector data from the item has been stored.
        """
        return self.tile_store.is_vector_ready(self.layer_name, item)

    def read_vector(
        self, item: Item, projection: Projection, bounds: PixelBounds
    ) -> list[Feature]:
        """Read vector data from the store.

        Args:
            item: the item to read.
            projection: the projection to read in.
            bounds: the bounds within which to read.

        Returns:
            the vector data
        """
        return self.tile_store.read_vector(self.layer_name, item, projection, bounds)

    def write_vector(self, item: Item, features: list[Feature]) -> None:
        """Write vector data to the store.

        Args:
            item: the item to write.
            features: the vector data.
        """
        self.tile_store.write_vector(self.layer_name, item, features)

is_raster_ready

is_raster_ready(item: Item, bands: list[str]) -> bool

Checks if this raster has been written to the store.

Parameters:

Name Type Description Default
item Item

the item.

required
bands list[str]

the list of bands identifying which specific raster to read.

required

Returns:

Type Description
bool

whether there is a raster in the store matching the source, item, and bands.

Source code in rslearn/tile_stores/tile_store.py
def is_raster_ready(self, item: Item, bands: list[str]) -> bool:
    """Checks if this raster has been written to the store.

    Args:
        item: the item.
        bands: the list of bands identifying which specific raster to read.

    Returns:
        whether there is a raster in the store matching the source, item, and
            bands.
    """
    return self.tile_store.is_raster_ready(self.layer_name, item, bands)

get_raster_bands

get_raster_bands(item: Item) -> list[list[str]]

Get the sets of bands that have been stored for the specified item.

Parameters:

Name Type Description Default
item Item

the item.

required

Returns:

Type Description
list[list[str]]

a list of lists of bands that are in the tile store (with one raster stored corresponding to each inner list). If no rasters are ready for this item, returns empty list.

Source code in rslearn/tile_stores/tile_store.py
def get_raster_bands(self, item: Item) -> list[list[str]]:
    """Get the sets of bands that have been stored for the specified item.

    Args:
        item: the item.

    Returns:
        a list of lists of bands that are in the tile store (with one raster
            stored corresponding to each inner list). If no rasters are ready for
            this item, returns empty list.
    """
    return self.tile_store.get_raster_bands(self.layer_name, item)

get_raster_bounds

get_raster_bounds(item: Item, bands: list[str], projection: Projection) -> PixelBounds

Get the bounds of the raster in the specified projection.

Parameters:

Name Type Description Default
item Item

the item to check.

required
bands list[str]

the list of bands identifying which specific raster to read. These bands must match the bands of a stored raster.

required
projection Projection

the projection to get the raster's bounds in.

required

Returns:

Type Description
PixelBounds

the bounds of the raster in the projection.

Source code in rslearn/tile_stores/tile_store.py
def get_raster_bounds(
    self, item: Item, bands: list[str], projection: Projection
) -> PixelBounds:
    """Get the bounds of the raster in the specified projection.

    Args:
        item: the item to check.
        bands: the list of bands identifying which specific raster to read. These
            bands must match the bands of a stored raster.
        projection: the projection to get the raster's bounds in.

    Returns:
        the bounds of the raster in the projection.
    """
    return self.tile_store.get_raster_bounds(
        self.layer_name, item, bands, projection
    )

get_raster_metadata

get_raster_metadata(item: Item, bands: list[str]) -> RasterMetadata

Get metadata for a stored raster without reading pixel data.

Parameters:

Name Type Description Default
item Item

the item.

required
bands list[str]

the list of bands identifying which specific raster to read.

required

Returns:

Type Description
RasterMetadata

a RasterMetadata instance.

Source code in rslearn/tile_stores/tile_store.py
def get_raster_metadata(self, item: Item, bands: list[str]) -> RasterMetadata:
    """Get metadata for a stored raster without reading pixel data.

    Args:
        item: the item.
        bands: the list of bands identifying which specific raster to read.

    Returns:
        a RasterMetadata instance.
    """
    return self.tile_store.get_raster_metadata(self.layer_name, item, bands)

read_raster

read_raster(item: Item, bands: list[str], projection: Projection, bounds: PixelBounds, resampling: Resampling = bilinear) -> RasterArray

Read raster data from the store.

Parameters:

Name Type Description Default
item Item

the item to read.

required
bands list[str]

the list of bands identifying which specific raster to read. These bands must match the bands of a stored raster.

required
projection Projection

the projection to read in.

required
bounds PixelBounds

the bounds to read.

required
resampling Resampling

the resampling method to use in case reprojection is needed.

bilinear

Returns:

Type Description
RasterArray

the raster data

Source code in rslearn/tile_stores/tile_store.py
def read_raster(
    self,
    item: Item,
    bands: list[str],
    projection: Projection,
    bounds: PixelBounds,
    resampling: Resampling = Resampling.bilinear,
) -> RasterArray:
    """Read raster data from the store.

    Args:
        item: the item to read.
        bands: the list of bands identifying which specific raster to read. These
            bands must match the bands of a stored raster.
        projection: the projection to read in.
        bounds: the bounds to read.
        resampling: the resampling method to use in case reprojection is needed.

    Returns:
        the raster data
    """
    return self.tile_store.read_raster(
        self.layer_name, item, bands, projection, bounds, resampling
    )

write_raster

write_raster(item: Item, bands: list[str], projection: Projection, bounds: PixelBounds, raster: RasterArray) -> None

Write raster data to the store.

Parameters:

Name Type Description Default
item Item

the item to write.

required
bands list[str]

the list of bands in the array.

required
projection Projection

the projection of the array.

required
bounds PixelBounds

the bounds of the array.

required
raster RasterArray

the raster data.

required
Source code in rslearn/tile_stores/tile_store.py
def write_raster(
    self,
    item: Item,
    bands: list[str],
    projection: Projection,
    bounds: PixelBounds,
    raster: RasterArray,
) -> None:
    """Write raster data to the store.

    Args:
        item: the item to write.
        bands: the list of bands in the array.
        projection: the projection of the array.
        bounds: the bounds of the array.
        raster: the raster data.
    """
    self.tile_store.write_raster(
        self.layer_name, item, bands, projection, bounds, raster
    )

write_raster_file

write_raster_file(item: Item, bands: list[str], fname: UPath, time_range: tuple[datetime, datetime] | None = None) -> None

Write raster data to the store.

Parameters:

Name Type Description Default
item Item

the item to write.

required
bands list[str]

the list of bands in the array.

required
fname UPath

the raster file.

required
time_range tuple[datetime, datetime] | None

optional time range for the raster.

None
Source code in rslearn/tile_stores/tile_store.py
def write_raster_file(
    self,
    item: Item,
    bands: list[str],
    fname: UPath,
    time_range: tuple[datetime, datetime] | None = None,
) -> None:
    """Write raster data to the store.

    Args:
        item: the item to write.
        bands: the list of bands in the array.
        fname: the raster file.
        time_range: optional time range for the raster.
    """
    self.tile_store.write_raster_file(
        self.layer_name, item, bands, fname, time_range=time_range
    )

is_vector_ready

is_vector_ready(item: Item) -> bool

Checks if this vector item has been written to the store.

Parameters:

Name Type Description Default
item Item

the item.

required

Returns:

Type Description
bool

whether the vector data from the item has been stored.

Source code in rslearn/tile_stores/tile_store.py
def is_vector_ready(self, item: Item) -> bool:
    """Checks if this vector item has been written to the store.

    Args:
        item: the item.

    Returns:
        whether the vector data from the item has been stored.
    """
    return self.tile_store.is_vector_ready(self.layer_name, item)

read_vector

read_vector(item: Item, projection: Projection, bounds: PixelBounds) -> list[Feature]

Read vector data from the store.

Parameters:

Name Type Description Default
item Item

the item to read.

required
projection Projection

the projection to read in.

required
bounds PixelBounds

the bounds within which to read.

required

Returns:

Type Description
list[Feature]

the vector data

Source code in rslearn/tile_stores/tile_store.py
def read_vector(
    self, item: Item, projection: Projection, bounds: PixelBounds
) -> list[Feature]:
    """Read vector data from the store.

    Args:
        item: the item to read.
        projection: the projection to read in.
        bounds: the bounds within which to read.

    Returns:
        the vector data
    """
    return self.tile_store.read_vector(self.layer_name, item, projection, bounds)

write_vector

write_vector(item: Item, features: list[Feature]) -> None

Write vector data to the store.

Parameters:

Name Type Description Default
item Item

the item to write.

required
features list[Feature]

the vector data.

required
Source code in rslearn/tile_stores/tile_store.py
def write_vector(self, item: Item, features: list[Feature]) -> None:
    """Write vector data to the store.

    Args:
        item: the item to write.
        features: the vector data.
    """
    self.tile_store.write_vector(self.layer_name, item, features)