geonode.thumbs.thumbnails
Attributes
Functions
|
Create a thumbnail with a GeoServer request. |
|
Function generating and saving a thumbnail of the given instance (Dataset or Map), which is composed of |
|
Method returning file name for the thumbnail. |
|
Function returning a list mapping instance's datasets to their locations, enabling to construct a minimum |
Module Contents
- geonode.thumbs.thumbnails.create_gs_thumbnail_geonode(instance, overwrite=False, check_bbox=False)[source]
Create a thumbnail with a GeoServer request.
- geonode.thumbs.thumbnails.create_thumbnail(instance: geonode.layers.models.Dataset | geonode.maps.models.Map, wms_version: str = settings.OGC_SERVER['default'].get('WMS_VERSION', '1.3.0'), bbox: List | Tuple | None = None, forced_crs: str | None = None, styles: List | None = None, overwrite: bool = False, background_zoom: int | None = None) None[source]
Function generating and saving a thumbnail of the given instance (Dataset or Map), which is composed of outcomes of WMS GetMap queries to the instance’s datasets providers, and an outcome of querying background provider for thumbnail’s background (by default Slippy Map provider).
- Parameters:
instance – instance of Dataset or Map models
wms_version – WMS version of the query
bbox – bounding box of the thumbnail in format: (west, east, south, north, CRS), where CRS is in format “EPSG:XXXX”
forced_crs – CRS which should be used to fetch data from WMS services in format “EPSG:XXXX”. By default all data is translated and retrieved in EPSG:3857, since this enables background fetching from Slippy Maps providers. Forcing another CRS can cause skipping background generation in the thumbnail
styles – styles, which OGC server should use for rendering an image
overwrite – overwrite existing thumbnail
background_zoom – zoom of the XYZ Slippy Map used to retrieve background image, if Slippy Map is used as background
- geonode.thumbs.thumbnails._generate_thumbnail_name(instance: geonode.layers.models.Dataset | geonode.maps.models.Map | geonode.documents.models.Document | geonode.geoapps.models.GeoApp) str | None[source]
Method returning file name for the thumbnail. If provided instance is a Map, and doesn’t have any defined datasets, None is returned.
- Parameters:
instance – instance of Dataset or Map models
- Returns:
file name for the thumbnail
- Raises:
ThumbnailError – if provided instance is neither an instance of the Map nor of the Dataset
- geonode.thumbs.thumbnails._datasets_locations(instance: geonode.layers.models.Dataset | geonode.maps.models.Map, compute_bbox: bool = False, target_crs: str = 'EPSG:3857') Tuple[List[List], List][source]
Function returning a list mapping instance’s datasets to their locations, enabling to construct a minimum number of WMS request for multiple datasets of the same OGC source (ensuring datasets order for Maps)
- Parameters:
instance – Instance of Dataset or Map models
compute_bbox – flag determining whether a BBOX containing the instance should be computed, based on instance’s datasets
target_crs – valid only when compute_bbox is True - CRS of the returned BBOX
- Returns:
A tuple containing:
A list that maps datasets to their locations, preserving the correct order of datasets.
Optionally, a list with five elements representing the west, east, south, north boundaries of the instance and the CRS, if compute_bbox is True.
Example:
[ { "http://localhost:8080/geoserver/": ["geonode:layer1", "geonode:layer2"] } ]