gws.plugin.raster_layer.provider

Image set provider for raster layers.

Source code: gws.plugin.raster_layer.provider

Module Contents

class gws.plugin.raster_layer.provider.Config(*args, **kwargs)

Bases: gws.Config

Set of georeferenced image files for a raster layer.

crs: gws.CrsName | None

CRS for images that have none.

pathPattern: str | None

Glob pattern for image files.

paths: list[gws.FilePath] | None

Image files to show.

class gws.plugin.raster_layer.provider.ImageEntry(*args, **kwargs)

Bases: gws.Data

A georeferenced image file.

bounds: gws.Bounds

Image bounds in the image CRS.

path: str

File path.

class gws.plugin.raster_layer.provider.Object

Bases: gws.Node

Set of georeferenced image files, given as paths or a glob pattern.

crs: gws.Crs | None

CRS for images that have none.

paths: list[str]

Image file paths.

cache_hash()

Compute a hash of the provider settings.

Returns:

Hash string, built from the paths and the CRS.

configure()

Configuration hook.

Called when the node is initialized. Raising an exception here aborts the creation of the node.

enumerate_images(default_crs: gws.Crs) → list[ImageEntry]

Read the bounds of the image files.

Files that cannot be opened, and files in a CRS other than the CRS of the first image, are skipped with a configuration warning.

Parameters:

default_crs – CRS for images that have none.

Returns:

Image entries, all in the same CRS.

make_tile_index(entries: list[ImageEntry], file_name: str) → str

Create a MapServer tile index shapefile for the images.

The index has a polygon per image with the file path in the location column, and a spatial index.

Parameters:
  • entries – Images to index.

  • file_name – Base name of the shapefile, in the object cache directory.

Returns:

Path to the shapefile.