geonode.thumbs.thumbnails ========================= .. py:module:: geonode.thumbs.thumbnails Attributes ---------- .. autoapisummary:: geonode.thumbs.thumbnails.logger Functions --------- .. autoapisummary:: geonode.thumbs.thumbnails.create_gs_thumbnail_geonode geonode.thumbs.thumbnails.create_thumbnail geonode.thumbs.thumbnails._generate_thumbnail_name geonode.thumbs.thumbnails._datasets_locations Module Contents --------------- .. py:data:: logger .. py:function:: create_gs_thumbnail_geonode(instance, overwrite=False, check_bbox=False) Create a thumbnail with a GeoServer request. .. py:function:: create_thumbnail(instance: Union[geonode.layers.models.Dataset, geonode.maps.models.Map], wms_version: str = settings.OGC_SERVER['default'].get('WMS_VERSION', '1.3.0'), bbox: Optional[Union[List, Tuple]] = None, forced_crs: Optional[str] = None, styles: Optional[List] = None, overwrite: bool = False, background_zoom: Optional[int] = None) -> None 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). :param instance: instance of Dataset or Map models :param wms_version: WMS version of the query :param bbox: bounding box of the thumbnail in format: (west, east, south, north, CRS), where CRS is in format "EPSG:XXXX" :param 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 :param styles: styles, which OGC server should use for rendering an image :param overwrite: overwrite existing thumbnail :param background_zoom: zoom of the XYZ Slippy Map used to retrieve background image, if Slippy Map is used as background .. py:function:: _generate_thumbnail_name(instance: Union[geonode.layers.models.Dataset, geonode.maps.models.Map, geonode.documents.models.Document, geonode.geoapps.models.GeoApp]) -> Optional[str] Method returning file name for the thumbnail. If provided instance is a Map, and doesn't have any defined datasets, None is returned. :param instance: instance of Dataset or Map models :return: file name for the thumbnail :raises ThumbnailError: if provided instance is neither an instance of the Map nor of the Dataset .. py:function:: _datasets_locations(instance: Union[geonode.layers.models.Dataset, geonode.maps.models.Map], compute_bbox: bool = False, target_crs: str = 'EPSG:3857') -> Tuple[List[List], List] 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) :param instance: Instance of Dataset or Map models :param compute_bbox: flag determining whether a BBOX containing the instance should be computed, based on instance's datasets :param target_crs: valid only when compute_bbox is True - CRS of the returned BBOX :return: 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: .. code-block:: json [ { "http://localhost:8080/geoserver/": ["geonode:layer1", "geonode:layer2"] } ]