geonode.thumbs.tests ==================== .. py:module:: geonode.thumbs.tests Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/geonode/thumbs/tests/test_backgrounds/index /autoapi/geonode/thumbs/tests/test_integration/index /autoapi/geonode/thumbs/tests/test_unit/index Attributes ---------- .. autoapisummary:: geonode.thumbs.tests.resource_manager geonode.thumbs.tests.FIXTURES_DIR geonode.thumbs.tests.http_client geonode.thumbs.tests.logger geonode.thumbs.tests.LOCAL_TIMEOUT geonode.thumbs.tests.EXPECTED_RESULTS_DIR geonode.thumbs.tests.logger geonode.thumbs.tests.WMTS_TILEMATRIX_LEVELS geonode.thumbs.tests.THUMBNAIL_BACKGROUND geonode.thumbs.tests.EXPECTED_RESULTS_DIR geonode.thumbs.tests.base_request_url geonode.thumbs.tests.mocked_requests Classes ------- .. autoapisummary:: geonode.thumbs.tests.Document geonode.thumbs.tests.GeoApp geonode.thumbs.tests.Dataset geonode.thumbs.tests.DisableDjangoSignals geonode.thumbs.tests.Map geonode.thumbs.tests.MapLayer geonode.thumbs.tests.GeoNodeBaseTestSupport geonode.thumbs.tests.GeoNodeBaseSimpleTestSupport geonode.thumbs.tests.ThumbnailsUtilsUnitTest geonode.thumbs.tests.ThumbnailsUnitTest geonode.thumbs.tests.Map geonode.thumbs.tests.MapLayer geonode.thumbs.tests.ResourceManager geonode.thumbs.tests.DisableDjangoSignals geonode.thumbs.tests.GeoNodeBaseTestSupport geonode.thumbs.tests.Dataset geonode.thumbs.tests.OSMTileBackground geonode.thumbs.tests.WikiMediaTileBackground geonode.thumbs.tests.GenericXYZBackground geonode.thumbs.tests.GenericWMSBackground geonode.thumbs.tests.GeoNodeThumbnailTileBackground geonode.thumbs.tests.GeoNodeThumbnailsIntegration geonode.thumbs.tests.GeoNodeBaseTestSupport geonode.thumbs.tests.GenericWMTSBackground geonode.thumbs.tests.Response geonode.thumbs.tests.GeoNodeThumbnailWMTSBackground Functions --------- .. autoapisummary:: geonode.thumbs.tests.check_ogc_backend geonode.thumbs.tests.on_ogc_backend geonode.thumbs.tests.create_gs_thumbnail_geonode geonode.thumbs.tests.create_thumbnail geonode.thumbs.tests.all_public geonode.thumbs.tests.create_models geonode.thumbs.tests.remove_models geonode.thumbs.tests.create_single_dataset geonode.thumbs.tests.get_mock Package Contents ---------------- .. py:class:: Document Bases: :py:obj:`geonode.base.models.ResourceBase` A document is any kind of information that can be attached to a map such as pdf, images, videos, xls... .. py:attribute:: extension .. py:attribute:: doc_url .. py:method:: __str__() .. py:method:: get_absolute_url() .. py:method:: allowed_permissions() .. py:method:: compact_permission_labels() .. py:property:: name .. py:property:: name_long .. py:property:: href .. py:property:: is_local .. py:property:: download_is_ajax_safe .. py:property:: is_file .. py:property:: mime_type .. py:property:: is_audio .. py:property:: is_image .. py:property:: is_video .. py:property:: class_name .. py:property:: embed_url .. py:property:: download_url .. py:class:: Meta Bases: :py:obj:`geonode.base.models.ResourceBase.Meta` .. py:class:: GeoApp(*args, **kwargs) Bases: :py:obj:`geonode.base.models.ResourceBase` A GeoApp it is a generic container for every client applications the user might want to create or define. .. py:attribute:: PERMISSIONS .. py:attribute:: name .. py:attribute:: last_modified .. py:method:: __str__() .. py:property:: class_name .. py:property:: sender .. py:property:: center . A handy shortcut for the center_x and center_y properties as a tuple (read only) .. py:property:: type .. py:property:: is_public . Returns True if anonymous (public) user can view geoapp. .. py:property:: keywords_list .. py:method:: get_absolute_url() .. py:property:: embed_url .. py:data:: resource_manager .. py:class:: Dataset(*args, **kwargs) Bases: :py:obj:`geonode.base.models.ResourceBase` Dataset (inherits ResourceBase fields) .. py:attribute:: PERMISSIONS .. py:attribute:: objects .. py:attribute:: workspace .. py:attribute:: store .. py:attribute:: name .. py:attribute:: typename .. py:attribute:: ows_url .. py:attribute:: is_mosaic .. py:attribute:: has_time .. py:attribute:: has_elevation .. py:attribute:: time_regex .. py:attribute:: elevation_regex .. py:attribute:: ptype .. py:attribute:: default_style .. py:attribute:: styles .. py:attribute:: remote_service .. py:attribute:: charset .. py:attribute:: use_featureinfo_custom_template .. py:attribute:: featureinfo_custom_template .. py:method:: is_vector() .. py:property:: is_raster .. py:property:: display_type .. py:property:: data_model .. py:property:: data_objects .. py:property:: attributes .. py:property:: service_typename .. py:property:: gtype .. py:method:: get_base_file() Get the shp or geotiff file for this layer. .. py:method:: get_absolute_url() .. py:property:: capabilities_url .. py:property:: dataset_ows_url .. py:property:: embed_url .. py:method:: attribute_config() .. py:method:: __str__() .. py:class:: Meta Bases: :py:obj:`geonode.base.models.ResourceBase.Meta` .. py:attribute:: permissions :value: (('change_dataset_data', 'Can edit layer data'), ('change_dataset_style', 'Can change layer style')) .. py:attribute:: unique_together :value: ('store', 'workspace', 'name') .. py:attribute:: LEVEL_READ :value: 'dataset_readonly' .. py:attribute:: LEVEL_WRITE :value: 'dataset_readwrite' .. py:attribute:: LEVEL_ADMIN :value: 'dataset_admin' .. py:property:: maps .. py:method:: get_linked_resources(as_target: bool = False) Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets) .. py:property:: download_url .. py:property:: maplayers .. py:method:: allowed_permissions() .. py:property:: class_name .. py:method:: view_count_up(user, do_local=False) increase view counter, if user is not owner and not super @param user which views layer @type User model @param do_local - do local counter update even if pubsub is enabled @type bool .. py:class:: DisableDjangoSignals(disabled_signals=None, skip=False) Python3 class temporarily disabling django signals on model creation. usage: with DisableDjangoSignals(): .. py:attribute:: skip .. py:attribute:: stashed_signals .. py:attribute:: disabled_signals .. py:method:: __enter__() .. py:method:: __exit__(exc_type, exc_val, exc_tb) .. py:method:: disconnect(signal) .. py:method:: reconnect(signal) .. py:class:: Map(*args, **kwargs) Bases: :py:obj:`geonode.base.models.ResourceBase` A Map aggregates several layers together and annotates them with a viewport configuration. .. py:attribute:: last_modified .. py:attribute:: urlsuffix .. py:attribute:: featuredurl .. py:method:: __str__() .. py:property:: datasets .. py:method:: get_linked_resources(as_target: bool = False) Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets) .. py:method:: json(dataset_filter) Get a JSON representation of this map suitable for sending to geoserver for creating a download of all layers .. py:method:: keyword_list() .. py:method:: get_absolute_url() .. py:property:: embed_url .. py:method:: get_bbox_from_datasets(layers) Calculate the bbox from a given list of Dataset objects bbox format: [xmin, xmax, ymin, ymax] .. py:property:: sender .. py:property:: class_name .. py:property:: is_public Returns True if anonymous (public) user can view map. .. py:property:: dataset_group Returns layer group name from local OWS for this map instance. .. py:method:: publish_dataset_group() Publishes local map layers as WMS layer group on local OWS. .. py:class:: Meta Bases: :py:obj:`geonode.base.models.ResourceBase.Meta` .. py:class:: MapLayer Bases: :py:obj:`django.db.models.Model` The MapLayer model represents a layer included in a map. This doesn't just identify the dataset, but also extra options such as which style to load and the file format to use for image tiles. .. py:attribute:: map .. py:attribute:: dataset .. py:attribute:: extra_params .. py:attribute:: name .. py:attribute:: store .. py:attribute:: current_style .. py:attribute:: ows_url .. py:attribute:: local .. py:attribute:: order .. py:attribute:: visibility .. py:attribute:: opacity .. py:property:: dataset_title Used by geonode/maps/templates/maps/map_download.html .. py:property:: local_link Used by geonode/maps/templates/maps/map_download.html .. py:property:: get_legend .. py:class:: Meta .. py:attribute:: ordering :value: ['-pk'] .. py:method:: __str__() .. py:class:: GeoNodeBaseTestSupport Bases: :py:obj:`django.test.testcases.TestCase` .. py:attribute:: type :value: None .. py:attribute:: obj_ids :value: [] .. py:attribute:: integration :value: False .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: get_obj_ids() .. py:method:: get_integration() .. py:method:: get_type() .. py:method:: setUp() .. py:class:: GeoNodeBaseSimpleTestSupport Bases: :py:obj:`django.test.testcases.SimpleTestCase` .. py:data:: FIXTURES_DIR :value: 'geonode/thumbs/tests/fixtures/' .. py:class:: ThumbnailsUtilsUnitTest Bases: :py:obj:`geonode.tests.base.GeoNodeBaseSimpleTestSupport` .. py:method:: test_create_getmap_request() .. py:method:: test_make_bbox_to_pixels_transf_same() .. py:method:: test_make_bbox_to_pixels_transf_diff() .. py:method:: test_expand_bbox_to_ratio() .. py:class:: ThumbnailsUnitTest Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:attribute:: fixtures .. py:attribute:: re_uuid :value: '[0-F]{8}-([0-F]{4}-){3}[0-F]{12}' .. py:method:: setUpClass() :classmethod: .. py:method:: test_generate_thumbnail_name_dataset() .. py:method:: test_get_unique_upload_path() .. py:method:: test_generate_thumbnail_name_map_empty(layers_mock) .. py:method:: test_generate_thumbnail_name_map(uuid_mock, layers_mock) .. py:method:: test_generate_thumbnail_name_document() .. py:method:: test_generate_thumbnail_name_geoapp() .. py:method:: test_datasets_locations_dataset() .. py:method:: test_datasets_locations_dataset_default_bbox() .. py:method:: test_datasets_locations_dataset_bbox() .. py:method:: test_datasets_locations_simple_map() .. py:method:: test_datasets_locations_simple_map_default_bbox() .. py:method:: test_datasets_locations_composition_map_default_bbox() .. py:method:: test_create_map_thumbnail_using_ll_bbox_polygon() .. py:class:: Map(*args, **kwargs) Bases: :py:obj:`geonode.base.models.ResourceBase` A Map aggregates several layers together and annotates them with a viewport configuration. .. py:attribute:: last_modified .. py:attribute:: urlsuffix .. py:attribute:: featuredurl .. py:method:: __str__() .. py:property:: datasets .. py:method:: get_linked_resources(as_target: bool = False) Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets) .. py:method:: json(dataset_filter) Get a JSON representation of this map suitable for sending to geoserver for creating a download of all layers .. py:method:: keyword_list() .. py:method:: get_absolute_url() .. py:property:: embed_url .. py:method:: get_bbox_from_datasets(layers) Calculate the bbox from a given list of Dataset objects bbox format: [xmin, xmax, ymin, ymax] .. py:property:: sender .. py:property:: class_name .. py:property:: is_public Returns True if anonymous (public) user can view map. .. py:property:: dataset_group Returns layer group name from local OWS for this map instance. .. py:method:: publish_dataset_group() Publishes local map layers as WMS layer group on local OWS. .. py:class:: Meta Bases: :py:obj:`geonode.base.models.ResourceBase.Meta` .. py:class:: MapLayer Bases: :py:obj:`django.db.models.Model` The MapLayer model represents a layer included in a map. This doesn't just identify the dataset, but also extra options such as which style to load and the file format to use for image tiles. .. py:attribute:: map .. py:attribute:: dataset .. py:attribute:: extra_params .. py:attribute:: name .. py:attribute:: store .. py:attribute:: current_style .. py:attribute:: ows_url .. py:attribute:: local .. py:attribute:: order .. py:attribute:: visibility .. py:attribute:: opacity .. py:property:: dataset_title Used by geonode/maps/templates/maps/map_download.html .. py:property:: local_link Used by geonode/maps/templates/maps/map_download.html .. py:property:: get_legend .. py:class:: Meta .. py:attribute:: ordering :value: ['-pk'] .. py:method:: __str__() .. py:function:: check_ogc_backend(backend_package) Check that geonode use a particular OGC Backend integration :param backend_package: django app of backend to use :type backend_package: str :return: bool :rtype: bool .. py:function:: on_ogc_backend(backend_package) Decorator for function specific to a certain ogc backend. This decorator will wrap function so it only gets executed if the specified ogc backend is currently used. If not, the function will just be skipped. Useful to decorate features/tests that only available for specific backend. .. py:class:: ResourceManager(concrete_manager=None) Bases: :py:obj:`ResourceManagerInterface` .. py:attribute:: _concrete_resource_manager .. py:method:: _get_concrete_manager() .. py:method:: _get_instance(uuid: str) -> geonode.base.models.ResourceBase :classmethod: .. py:method:: search(filter: dict, /, resource_type: Optional[object]) -> django.db.models.query.QuerySet Returns a QuerySet of the filtered resources into the DB. - The 'filter' parameter should be an dictionary with the filtering criteria; - 'filter' = None won't return any result - 'filter' = {} will return the whole set - The 'resource_type' parameter allows to specify the concrete resource model (e.g. Dataset, Document, Map, ...) - 'resource_type' must be a class - 'resource_type' = Dataset will return a set of the only available Layers .. py:method:: exists(uuid: str, /, instance: geonode.base.models.ResourceBase = None) -> bool Returns 'True' or 'False' if the resource exists or not. - If 'instance' is provided, it will take precedence on 'uuid' - The existance criteria might be subject to the 'concrete resource manager' one, dependent on the resource type e.g.: a local Dataset existance check will be constrained by the existance of the layer on the GIS backend .. py:method:: delete(uuid: str, /, instance: geonode.base.models.ResourceBase = None) -> int Deletes a resource from the DB. - If 'instance' is provided, it will take precedence on 'uuid' - It will also fallback to the 'concrete resource manager' delete model. - This will eventually delete the related resources on the GIS backend too. .. py:method:: create(uuid: str, /, resource_type: Optional[object] = None, defaults: dict = {}) -> geonode.base.models.ResourceBase The method will just create a new 'resource_type' on the DB model and invoke the 'post save' triggers. - It assumes any GIS backend resource (e.g. layers on GeoServer) already exist. - It is possible to pass initial default values, like the 'files' from the 'storage_manager' trhgouh the 'defaults' dictionary .. py:method:: update(uuid: str, /, instance: geonode.base.models.ResourceBase = None, xml_file: str = None, metadata_uploaded: bool = False, vals: dict = {}, regions: list = [], keywords: list = [], custom: dict = {}, notify: bool = True, extra_metadata: list = [], *args, **kwargs) -> geonode.base.models.ResourceBase The method will update an existing 'resource_type' on the DB model and invoke the 'post save' triggers. - It assumes any GIS backend resource (e.g. layers on GeoServer) already exist. - It is possible to pass initial default values, like the 'files' from the 'storage_manager' trhgouh the 'vals' dictionary - The 'xml_file' parameter allows to fetch metadata values from a file - The 'notify' parameter allows to notify the members that the resource has been updated .. py:method:: ingest(files: List[str], /, uuid: str = None, resource_type: Optional[object] = None, defaults: dict = {}, **kwargs) -> geonode.base.models.ResourceBase The method allows to create a resource by providing the list of files. e.g.: In [1]: from geonode.resource.manager import resource_manager In [2]: from geonode.layers.models import Dataset In [3]: from django.contrib.auth import get_user_model In [4]: admin = get_user_model().objects.get(username='admin') In [5]: files = ["/.../san_andres_y_providencia_administrative.dbf", "/.../san_andres_y_providencia_administrative.prj", ...: "/.../san_andres_y_providencia_administrative.shx", "/.../san_andres_y_providencia_administrative.sld", "/.../san_andres_y_providencia_administrative.shp"] In [6]: resource_manager.ingest(files, resource_type=Dataset, defaults={'owner': admin}) .. py:method:: copy(instance: geonode.base.models.ResourceBase, /, uuid: str = None, owner: django.conf.settings.AUTH_USER_MODEL = None, defaults: dict = {}) -> geonode.base.models.ResourceBase The method makes a copy of the existing resource. - It makes a copy of the files - It creates a new layer on the GIS backend in the case the ResourceType is a Dataset .. py:method:: append(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs) The method appends data to an existing resource. - It assumes any GIS backend resource (e.g. layers on GeoServer) already exist. .. py:method:: replace(instance: geonode.base.models.ResourceBase, vals: dict = {}, *args, **kwargs) The method replaces data of an existing resource. - It assumes any GIS backend resource (e.g. layers on GeoServer) already exist. .. py:method:: _validate_resource(instance: geonode.base.models.ResourceBase, action_type: str) -> bool .. py:method:: exec(method: str, uuid: str, /, instance: geonode.base.models.ResourceBase = None, **kwargs) -> geonode.base.models.ResourceBase A generic 'exec' method allowing to invoke specific methods of the concrete resource manager not exposed by the interface. - The parameter 'method' represents the actual name of the concrete method to invoke. .. py:method:: remove_permissions(uuid: str, /, instance: geonode.base.models.ResourceBase = None) -> bool Remove object permissions on given resource. If is a layer removes the layer specific permissions then the resourcebase permissions. .. py:method:: set_permissions(uuid: str, /, instance: geonode.base.models.ResourceBase = None, owner: django.conf.settings.AUTH_USER_MODEL = None, permissions: dict = {}, created: bool = False, approval_status_changed: bool = False, group_status_changed: bool = False) -> bool Sets the permissions of a resource. - It optionally gets a JSON 'perm_spec' through the 'permissions' parameter - If no 'perm_spec' is provided, it will set the default permissions (owner only) .. py:method:: set_thumbnail(uuid: str, /, instance: geonode.base.models.ResourceBase = None, overwrite: bool = True, check_bbox: bool = True, thumbnail=None) -> bool Allows to generate or re-generate the Thumbnail of a Resource. .. py:data:: http_client .. py:class:: DisableDjangoSignals(disabled_signals=None, skip=False) Python3 class temporarily disabling django signals on model creation. usage: with DisableDjangoSignals(): .. py:attribute:: skip .. py:attribute:: stashed_signals .. py:attribute:: disabled_signals .. py:method:: __enter__() .. py:method:: __exit__(exc_type, exc_val, exc_tb) .. py:method:: disconnect(signal) .. py:method:: reconnect(signal) .. py:class:: GeoNodeBaseTestSupport Bases: :py:obj:`django.test.testcases.TestCase` .. py:attribute:: type :value: None .. py:attribute:: obj_ids :value: [] .. py:attribute:: integration :value: False .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: get_obj_ids() .. py:method:: get_integration() .. py:method:: get_type() .. py:method:: setUp() .. 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:class:: Dataset(*args, **kwargs) Bases: :py:obj:`geonode.base.models.ResourceBase` Dataset (inherits ResourceBase fields) .. py:attribute:: PERMISSIONS .. py:attribute:: objects .. py:attribute:: workspace .. py:attribute:: store .. py:attribute:: name .. py:attribute:: typename .. py:attribute:: ows_url .. py:attribute:: is_mosaic .. py:attribute:: has_time .. py:attribute:: has_elevation .. py:attribute:: time_regex .. py:attribute:: elevation_regex .. py:attribute:: ptype .. py:attribute:: default_style .. py:attribute:: styles .. py:attribute:: remote_service .. py:attribute:: charset .. py:attribute:: use_featureinfo_custom_template .. py:attribute:: featureinfo_custom_template .. py:method:: is_vector() .. py:property:: is_raster .. py:property:: display_type .. py:property:: data_model .. py:property:: data_objects .. py:property:: attributes .. py:property:: service_typename .. py:property:: gtype .. py:method:: get_base_file() Get the shp or geotiff file for this layer. .. py:method:: get_absolute_url() .. py:property:: capabilities_url .. py:property:: dataset_ows_url .. py:property:: embed_url .. py:method:: attribute_config() .. py:method:: __str__() .. py:class:: Meta Bases: :py:obj:`geonode.base.models.ResourceBase.Meta` .. py:attribute:: permissions :value: (('change_dataset_data', 'Can edit layer data'), ('change_dataset_style', 'Can change layer style')) .. py:attribute:: unique_together :value: ('store', 'workspace', 'name') .. py:attribute:: LEVEL_READ :value: 'dataset_readonly' .. py:attribute:: LEVEL_WRITE :value: 'dataset_readwrite' .. py:attribute:: LEVEL_ADMIN :value: 'dataset_admin' .. py:property:: maps .. py:method:: get_linked_resources(as_target: bool = False) Get all the linked resources to this ResourceBase instance. This is implemented as a method so that derived classes can override it (for instance, Maps may add related datasets) .. py:property:: download_url .. py:property:: maplayers .. py:method:: allowed_permissions() .. py:property:: class_name .. py:method:: view_count_up(user, do_local=False) increase view counter, if user is not owner and not super @param user which views layer @type User model @param do_local - do local counter update even if pubsub is enabled @type bool .. py:class:: OSMTileBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1) Bases: :py:obj:`GenericXYZBackground` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: url :value: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png' .. py:attribute:: tile_size :value: 256 .. py:class:: WikiMediaTileBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1) Bases: :py:obj:`GenericXYZBackground` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: url :value: 'https://maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png' .. py:attribute:: tile_size :value: 256 .. py:class:: GenericXYZBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1) Bases: :py:obj:`BaseThumbBackground` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: options .. py:attribute:: url .. py:attribute:: tile_size .. py:attribute:: tms :value: False .. py:attribute:: crs :value: 'EPSG:3857' .. py:attribute:: _epsg3857_max_x :value: 20026376.39 .. py:attribute:: _epsg3857_max_y :value: 20048966.1 .. py:attribute:: _mercantile_bbox :value: None .. py:method:: point3857to4326(x, y) .. py:method:: point4326to3857(x, y) .. py:method:: bbox3857to4326(x_min, x_max, y_min, y_max) Function converting BBOX from EPSG:3857 to EPSG:4326, keeping the order of the coordinates. To ensure no additional change is performed, conversion is based on top-left and bottom-right points conversion. .. py:method:: bbox4326to3857(x_min, x_max, y_min, y_max) Function converting BBOX from EPSG:4326 to EPSG:3857, keeping the order of the coordinates. To ensure no additional change is performed, conversion is based on top-left and bottom-right points conversion. .. py:method:: fetch(bbox: List, zoom: int = None, *args, **kwargs) The function fetching tiles from a Slippy Map provider, composing them into a single image, and cropping it to match the given BBOX. Retrieval of each tile is repeated self.max_retries times, waiting self.retry_delay seconds between consecutive requests. :param bbox: bounding box of the background image, dataset compliant format: [west, east, south, north, CRS] :param zoom: zoom with which to retrieve Slippy Map's tiles (by default, it's calculated based on width, height) :return: None if the CRS is different from self.tiles_crs, or background Image .. py:method:: calculate_zoom() .. py:class:: GenericWMSBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1) Bases: :py:obj:`BaseThumbBackground` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: options .. py:attribute:: service_url .. py:attribute:: dataset_name .. py:attribute:: format .. py:attribute:: version .. py:attribute:: styles .. py:attribute:: srid .. py:method:: bbox_to_projection(bbox: List) Function converting BBOX to target projection system, keeping the order of the coordinates. To ensure no additional change is performed, conversion is based on top-left and bottom-right points conversion. :param bbox: a dataset compliant BBOX: [west, east, south, north, CRS] .. py:method:: fetch(bbox: List, *args, **kwargs) Function fetching background image, based on the given BBOX. On error should raise an exception or return None. :param bbox: a dataset compliant BBOX: [west, east, south, north, CRS] :param *args*: not used, kept for API compatibility :param **kargs**: not used, kept for API compatibility .. py:function:: all_public() Ensure all layers, maps and documents are publicly available .. py:function:: create_models(type=None, integration=False) .. py:function:: remove_models(obj_ids, type=None, integration=False) .. py:function:: create_single_dataset(name, keywords=None, owner=None, group=None, **kwargs) .. py:data:: logger .. py:data:: LOCAL_TIMEOUT :value: 300 .. py:data:: EXPECTED_RESULTS_DIR :value: 'geonode/thumbs/tests/expected_results/' .. py:class:: GeoNodeThumbnailTileBackground Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:attribute:: dataset_coast_line :value: None .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: setUpClass() :classmethod: .. py:method:: tearDownClass() :classmethod: .. py:method:: test_tile_background_retries(request_mock) .. py:method:: test_tile_background_bbox_conversions() .. py:method:: test_tile_background_bbox_zoom_calculation() .. py:method:: _fetch_and_compare_background(generator, bbox_3857, expected_image_path, zoom=None) .. py:method:: test_tile_background_generic_fetch() .. py:method:: test_tile_background_generic_fetch_zoom() .. py:method:: test_tile_background_wikimedia_fetch() .. py:method:: test_tile_background_osm_fetch() .. py:method:: test_tile_background_tms_fetch() .. py:method:: test_wms_background_retries(request_mock) .. py:method:: test_wms_background_fetch_epsg3857() .. py:method:: test_wms_background_fetch_epsg4326() .. py:class:: GeoNodeThumbnailsIntegration Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:attribute:: dataset_coast_line :value: None .. py:attribute:: dataset_highway :value: None .. py:attribute:: map_composition :value: None .. py:method:: setUpClass() :classmethod: .. py:method:: _fetch_thumb_and_compare(url, expected_image) .. py:method:: test_dataset_default_thumb() .. py:method:: test_dataset_custom_thumbs() .. py:method:: test_map_default_thumb() .. py:method:: test_map_custom_thumbs() .. py:method:: test_UTM_dataset_thumbnail() .. py:class:: GeoNodeBaseTestSupport Bases: :py:obj:`django.test.testcases.TestCase` .. py:attribute:: type :value: None .. py:attribute:: obj_ids :value: [] .. py:attribute:: integration :value: False .. py:attribute:: fixtures :value: ['initial_data.json', 'group_test_data.json', 'default_oauth_apps.json'] .. py:method:: get_obj_ids() .. py:method:: get_integration() .. py:method:: get_type() .. py:method:: setUp() .. py:class:: GenericWMTSBackground(thumbnail_width: int, thumbnail_height: int, max_retries: int = 3, retry_delay: int = 1) Bases: :py:obj:`BaseThumbBackground` Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: options .. py:attribute:: levels .. py:attribute:: thumbnail_width .. py:attribute:: thumbnail_height .. py:method:: fetch(bbox: List, *args, **kwargs) Function fetching background image, based on the given BBOX. On error should raise an exception or return None. :param bbox: a dataset compliant BBOX: [west, east, south, north, CRS] .. py:method:: build_kvp_request(baseurl, layer, style, xyz) .. py:method:: build_request(xyz) .. py:method:: get_image_bbox_for_level(level, bbox) .. py:method:: get_tiles_coords(level, bbox) .. py:method:: get_level_for_targetpixelspan(target_pixelspan) .. py:method:: get_target_pixelspan(bbox) .. py:method:: get_levels_for_tilematrix() .. py:data:: logger .. py:data:: WMTS_TILEMATRIX_LEVELS .. py:data:: THUMBNAIL_BACKGROUND .. py:data:: EXPECTED_RESULTS_DIR :value: 'geonode/thumbs/tests/expected_results/' .. py:data:: base_request_url :value: 'https://myserver.com/WMTS?&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&layer=Hos... .. py:data:: mocked_requests .. py:class:: Response(status_code=200, content=None) .. py:attribute:: status_code .. py:attribute:: content .. py:function:: get_mock(*args) .. py:class:: GeoNodeThumbnailWMTSBackground Bases: :py:obj:`geonode.tests.base.GeoNodeBaseTestSupport` .. py:method:: setUpClass() :classmethod: .. py:method:: test_get_target_pixelspan(*args) .. py:method:: test_get_level_for_targetpixelspan(*args) .. py:method:: test_get_tiles_coords(*args) .. py:method:: test_build_request(*args) .. py:method:: test_tile_request(*args)