geonode.harvesting.harvesters.arcgis

Harvesters for ArcGIS based remote servers.

Attributes

logger

Classes

ArcgisRestApiLayerType

Generic enumeration.

ArcgisServiceType

Generic enumeration.

ArcgisServiceResourceExtractor

Abstract base class with the methods that must be reimplemented

ArcgisMapServiceResourceExtractor

Abstract base class with the methods that must be reimplemented

ArcgisImageServiceResourceExtractor

Abstract base class with the methods that must be reimplemented

ArcgisHarvesterWorker

Base class for harvesters.

Functions

parse_remote_url(→ Tuple[str, Optional[str], ...)

Parse the input url into the ArcGIS REST catalog URL and any service name.

get_resource_extractor(...)

A factory for instantiating the correct extractor for the resource

_parse_spatial_extent(→ Tuple[str, ...)

Module Contents

geonode.harvesting.harvesters.arcgis.logger[source]
class geonode.harvesting.harvesters.arcgis.ArcgisRestApiLayerType[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

GROUP_LAYER = 'Group Layer'[source]
FEATURE_LAYER = 'Feature Layer'[source]
class geonode.harvesting.harvesters.arcgis.ArcgisServiceType[source]

Bases: enum.Enum

Generic enumeration.

Derive from this class to define new enumerations.

MAP_SERVICE = 'MapServer'[source]
FEATURE_SERVICE = 'FeatureServer'[source]
GEOCODE_SERVICE = 'GeocodeServer'[source]
GEOPROCESSING_SERVICE = 'GPServer'[source]
GEOMETRY_SERVICE = 'GeometryServer'[source]
IMAGE_SERVICE = 'ImageServer'[source]
NETWORK_SERVICE = 'NAServer'[source]
GEODATA_SERVICE = 'GeoDataServer'[source]
GLOBE_SERVICE = 'GlobeServer'[source]
MOBILE_SERVICE = 'MobileServer'[source]
classmethod has_value(value)[source]
geonode.harvesting.harvesters.arcgis.parse_remote_url(url: str) Tuple[str, str | None, str | None][source]

Parse the input url into the ArcGIS REST catalog URL and any service name.

class geonode.harvesting.harvesters.arcgis.ArcgisServiceResourceExtractor(service, resource_name_filter: str | None = None)[source]

Bases: abc.ABC

Abstract base class with the methods that must be reimplemented in order to add support for additional ArcGIS REST services

resource_name_filter: str | None[source]
service: Type[source]
abstract get_num_resources() int[source]

Return the number of resources that can be extracted from the service.

abstract list_resources() List[geonode.harvesting.harvesters.base.BriefRemoteResource][source]

Return a list of BriefRemoteResource with the resources exposed by the service

abstract get_resource(harvestable_resource: geonode.harvesting.models.HarvestableResource) geonode.harvesting.harvesters.base.HarvestedResourceInfo[source]

Parse the remote resource into a HarvestedResourceInfo

_is_relevant_layer(layer_name: str) bool[source]
class geonode.harvesting.harvesters.arcgis.ArcgisMapServiceResourceExtractor(service: arcrest.MapService)[source]

Bases: ArcgisServiceResourceExtractor

Abstract base class with the methods that must be reimplemented in order to add support for additional ArcGIS REST services

service: arcrest.MapService[source]
http_session: requests.Session[source]
_cached_resources: List[geonode.harvesting.harvesters.base.BriefRemoteResource] | None[source]
get_num_resources() int[source]

Return the number of resources that can be extracted from the service.

list_resources() List[geonode.harvesting.harvesters.base.BriefRemoteResource][source]

Return a list of BriefRemoteResource with the resources exposed by the service

get_resource(harvestable_resource: geonode.harvesting.models.HarvestableResource)[source]

Parse the remote resource into a HarvestedResourceInfo

_extract_resources() List[geonode.harvesting.harvesters.base.BriefRemoteResource][source]
_list_sub_layers(arc_layer: arcrest.MapLayer) List[geonode.harvesting.harvesters.base.BriefRemoteResource][source]
_get_resource_descriptor(layer_representation: Dict, harvestable_resource: geonode.harvesting.models.HarvestableResource) geonode.harvesting.resourcedescriptor.RecordDescription[source]
_parse_brief_layer(arc_layer: arcrest.MapLayer) geonode.harvesting.harvesters.base.BriefRemoteResource[source]
class geonode.harvesting.harvesters.arcgis.ArcgisImageServiceResourceExtractor(service: arcrest.ImageService)[source]

Bases: ArcgisServiceResourceExtractor

Abstract base class with the methods that must be reimplemented in order to add support for additional ArcGIS REST services

service: arcrest.ImageService[source]
http_session: requests.Session[source]
get_num_resources() int[source]

Return the number of resources that can be extracted from the service.

list_resources() List[geonode.harvesting.harvesters.base.BriefRemoteResource][source]

Return a list of BriefRemoteResource with the resources exposed by the service

get_resource(harvestable_resource: geonode.harvesting.models.HarvestableResource) geonode.harvesting.harvesters.base.HarvestedResourceInfo[source]

Parse the remote resource into a HarvestedResourceInfo

_get_resource_name()[source]
_get_resource_descriptor(layer_representation: Dict, harvestable_resource: geonode.harvesting.models.HarvestableResource) geonode.harvesting.resourcedescriptor.RecordDescription[source]
geonode.harvesting.harvesters.arcgis.get_resource_extractor(resource_unique_identifier: str) ArcgisServiceResourceExtractor | None[source]

A factory for instantiating the correct extractor for the resource

class geonode.harvesting.harvesters.arcgis.ArcgisHarvesterWorker(remote_url: str, harvester_id: int, harvest_map_services: bool = True, harvest_image_services: bool = True, resource_name_filter: str | None = True, service_names_filter: List[str] | None = None)[source]

Bases: geonode.harvesting.harvesters.base.BaseHarvesterWorker

Base class for harvesters.

This provides two relevant things:

  • An interface that all custom GeoNode harvesting classes must implement;

  • Default implementation for common functionality.

harvest_map_services: bool[source]
harvest_image_services: bool[source]
resource_name_filter: str | None[source]
service_names_filter: List[str] | None[source]
http_session: requests.Session[source]
_arc_catalog: arcrest.Catalog | None[source]
_relevant_service_extractors: List[ArcgisMapServiceResourceExtractor | ArcgisImageServiceResourceExtractor] | None[source]
_supported_service_types[source]
property allows_copying_resources: bool[source]

Whether copying remote resources is implemented by this worker

property arc_catalog[source]
classmethod from_django_record(harvester: Harvester)[source]

Return a new instance of the worker from the django harvester

classmethod get_extra_config_schema() Dict | None[source]

Return a jsonschema schema to be used to validate models.Harvester objects

get_num_available_resources() int[source]

Return the number of available resources on the remote service.

If there is a problem retrieving the number of available resource, this method shall raise HarvestingException.

list_resources(offset: int | None = 0) List[geonode.harvesting.harvesters.base.BriefRemoteResource][source]

Return a list of resources from the remote service.

If there is a problem listing resource, this method shall raise HarvestingException.

check_availability(timeout_seconds: int | None = 5) bool[source]

Check whether the remote service is online

get_geonode_resource_type(remote_resource_type: str) Type[source]

Return the GeoNode type that should be created from the remote resource type

get_geonode_resource_defaults(harvested_info: geonode.harvesting.harvesters.base.HarvestedResourceInfo, harvestable_resource: geonode.harvesting.models.HarvestableResource) Dict[source]

Extract default values to be used by resource manager when updating a resource

get_resource(harvestable_resource: geonode.harvesting.models.HarvestableResource) geonode.harvesting.harvesters.base.HarvestedResourceInfo | None[source]

Harvest a single resource from the remote service.

The return value is an instance of HarvestedResourceInfo. It stores an instance of RecordDescription and additionally whatever type is required by child classes to be able to customize resource creation/update on the local GeoNode. Note that the default implementation of update_geonode_resource() only needs the RecordDescription. The possibility to return additional information exists solely for extensibility purposes and can be left as None in the simple cases.

_get_extractor_class(service_type: ArcgisServiceType) Type | None[source]
_get_service_extractors(service) List[source]
_get_relevant_services() List[ArcgisMapServiceResourceExtractor | ArcgisImageServiceResourceExtractor][source]
geonode.harvesting.harvesters.arcgis._parse_spatial_extent(raw_extent: Dict) Tuple[str, django.contrib.gis.geos.Polygon][source]