# Interface WritableTileMatrixSet

All Superinterfaces:
  `TileMatrixSet`

public interface WritableTileMatrixSet extends TileMatrixSet
A `TileMatrixSet` that can write and delete tile matrices.

All methods in this interface expect non-null arguments are return non-null values.

Since:
  1.2

- ## Method Summary

  Modifier and Type
  Method
  Description
  `WritableTileMatrix`
  `createTileMatrix(TileMatrix tiles)`
  Adds the given tile matrix to this set and returns a writable instance for later completion.
  `void`
  `deleteTileMatrix(String identifier)`
  Deletes a `TileMatrix` identified by the given name.
  `SortedMap<GenericName, ? extends WritableTileMatrix>`
  `getTileMatrices()`
  Returns all `WritableTileMatrix` instances in this set, together with their identifiers.

  ### Methods inherited from interface TileMatrixSet

  `getCoordinateReferenceSystem, getEnvelope, getIdentifier, getMetadata`

- ## Method Details

  - ### getTileMatrices

    SortedMap<GenericName, ? extends WritableTileMatrix> getTileMatrices()
    Returns all `WritableTileMatrix` instances in this set, together with their identifiers. For each value in the map, the associated key is `TileMatrix​.getIdentifier()`. Entries are sorted from coarser resolution (highest scale denominator) to most detailed resolution (lowest scale denominator).

    The returned view is unmodifiable but live: creations or removals of tile matrices in this set will be reflected on the returned map.

    Specified by:
      `getTileMatrices` in interface `TileMatrixSet`
    Returns:
      an unmodifiable view of all `WritableTileMatrix` instances with their identifiers.

  - ### createTileMatrix

    WritableTileMatrix createTileMatrix(TileMatrix tiles) throws DataStoreException
    Adds the given tile matrix to this set and returns a writable instance for later completion. Typically the given `TileMatrix` instance contains no tile and is used only as a template. If the `TileMatrix` is not empty, then the tiles that it contains are written immediately.

    The tiling scheme of the given tile matrix must be compatible with this set. In particular, it must use the same CRS as the value returned by `TileMatrixSet​.getCoordinateReferenceSystem()`. If not, an `IncompatibleResourceException` is thrown.

    This method returns a writable tile matrix with the same tiles as the given `TileMatrix`. However, the identifier of the returned tile matrix may be different.

    Parameters:
      `tiles` - the (potentially empty) tile matrix to create.
    Returns:
      a writable tile matrix to use for adding more tiles.
    Throws:
      `ReadOnlyStorageException` - if this tile matrix set is not writable. It may be caused by insufficient credentials.
      `IncompatibleResourceException` - if the tiling scheme of the given tile matrix is not compatible with this set.
      `DataStoreException` - if creating the tile matrix failed for another reason.

  - ### deleteTileMatrix

    void deleteTileMatrix(String identifier) throws DataStoreException
    Deletes a `TileMatrix` identified by the given name. The given identifier shall be the `TileMatrix​.getIdentifier().toString()` value of the tile matrix to delete.
    Parameters:
      `identifier` - identifier of the `TileMatrix` to delete.
    Throws:
      `NoSuchDataException` - if there is no tile matrix associated to the given identifier in this set.
      `ReadOnlyStorageException` - if this tile matrix set is not writable. It may be caused by insufficient credentials.
      `DataStoreException` - if deleting the tile matrix failed for another reason.