OGC API Package

OGC API Submodules

The following submodules are defined by this package.

ogcapi.admin module

Note

Module Details

OGCAPI “admin” module

This module defines parameters and configuration for the site administration of the TerraNexus ogcapi resources.

Created: 17 November 2020

@author: Dr. Matthew B.J. Purss

class ogcapi.admin.TerraNexus_ConfigAdmin(model, admin_site)

Bases: ModelAdmin

fieldsets = [(None, {'fields': ['ogcapi_maxRecordsLimit']}), ('Date information', {'classes': ['collapse'], 'fields': ['date_published']})]
list_display = ['record_id', 'ogcapi_maxRecordsLimit', 'date_published']
list_filter = ['date_published']
property media
search_fields = ['record_id', 'ogcapi_maxRecordsLimit']

ogcapi.apps module

Note

Module Details

OGCAPI Application Registration module

This Class module is required to register each Django package under the main web application.

Created: 11 September 2020

@author: Dr. Matthew B.J. Purss

class ogcapi.apps.OGCAPIConfig(app_name, app_module)

Bases: AppConfig

name = 'ogcapi'

ogcapi.consumers module

Note

Module Details

OGCAPI Asynchronous “Consumers” Module

This Class module defines the consumers for asynchronous requests to the ogcapi resources through TerraNexus.

This is the asynchronous equivalent to the “views” module.

Created: 26 May 2022

@author: Dr. Matthew B.J. Purss

class ogcapi.consumers.OGCAPICallbackFailedConsumer(*args, **kwargs)

Bases: AsyncJsonWebsocketConsumer

Note

Class Details Asynchronous JSON WebSocket Consumer Class for the OGC API Callback Failed Consumer

async connect()

Note

Function Details

Called by the front-end web application to establish a connection with this WebSocket Consumer

async disconnect(close_code)

Called when a WebSocket connection is closed.

async receive_json(content)

Called with decoded JSON content.

async response_message(event)

Note

Function Details

Called by back-end processes to send/publish a message to this WebSocket Connection.

Parameters:

event (JSON, required) – The event JSON object which contains the message information to send/publish to this WebSocket Connection.

class ogcapi.consumers.OGCAPICallbackInProgressConsumer(*args, **kwargs)

Bases: AsyncJsonWebsocketConsumer

Note

Class Details

Asynchronous JSON WebSocket Consumer Class for the OGC API Callback In-Progress Consumer

async connect()

Note

Function Details

Called by the front-end web application to establish a connection with this WebSocket Consumer

async disconnect(close_code)

Called when a WebSocket connection is closed.

async receive_json(content)

Called with decoded JSON content.

async response_message(event)

Note

Function Details

Called by back-end processes to send/publish a message to this WebSocket Connection.

Parameters:

event (JSON, required) – The event JSON object which contains the message information to send/publish to this WebSocket Connection.

class ogcapi.consumers.OGCAPICallbackSuccessConsumer(*args, **kwargs)

Bases: AsyncJsonWebsocketConsumer

Note

Class Details

Asynchronous JSON WebSocket Consumer Class for the OGC API Callback Success Consumer

async connect()

Note

Function Details

Called by the front-end web application to establish a connection with this WebSocket Consumer

async disconnect(close_code)

Called when a WebSocket connection is closed.

async receive_json(content)

Called with decoded JSON content.

async response_message(event)

Note

Function Details

Called by back-end processes to send/publish a message to this WebSocket Connection.

Parameters:

event (JSON, required) – The event JSON object which contains the message information to send/publish to this WebSocket Connection.

class ogcapi.consumers.OGCAPIConsumer(*args, **kwargs)

Bases: AsyncJsonWebsocketConsumer

Note

Class Details Asynchronous JSON WebSocket Consumer Class for the general OGC API Consumer

async connect()

Note

Function Details

Called by the front-end web application to establish a connection with this WebSocket Consumer

async disconnect(close_code)

Called when a WebSocket connection is closed.

get_ogcapi_features_task = <@task: ogcapi.consumers.get_ogcapi_features_task of TerraNexus>
async receive_json(content)

Called with decoded JSON content.

async response_message(event)

Note

Function Details

Called by back-end processes to send/publish a message to this WebSocket Connection.

Parameters:

event (JSON, required) – The event JSON object which contains the message information to send/publish to this WebSocket Connection.

ogcapi.consumers tasks

ogcapi.consumers.OGCAPIConsumer.get_ogcapi_features_task(channels_group_name='OGCAPI_group', channels_user='default_user', ogcapi_url='/ogcapi', task_key='task_key')

Note

Function Details

Celery Task to find OGC API Collection Features in parallel and stream the results back to the TerraNexus Client.

Parameters:
  • channels_group_name (str, optional, default="OGCAPI_group") – Name of the Group to receive and send messages with.

  • channels_user (str, optional, default="default_user") – Name of the Group User.

  • ogcapi_url (str, optional, default="/ogcapi") – url to the relevant OGC API resource.

  • task_key (str, optional, default="task_key") – Unique identifier for the task.

Returns:

task_output – JSON compatible dictionary object is returned via the consumers “response_message” function.

Return type:

JSON

ogcapi.forms module

Note

Module Details

OGCAPI “Django Forms” Definition Module

This module contains the “Form” definitions for the OGCAPI resources.

Created: 11 September 2020

@author: Dr. Matthew B.J. Purss

class ogcapi.forms.OGCAPI_CollectionDisplayForm(*args, **kwargs)

Bases: Form

base_fields = {'ogcapi_url': <django.forms.fields.CharField object>}
declared_fields = {'ogcapi_url': <django.forms.fields.CharField object>}
error_css_class = 'error'
property media

Return all media required to render the widgets on this form.

required_css_class = 'required'
class ogcapi.forms.OGCAPI_JobResultForm(*args, request=None, ogcapi_job_results='{}', query_text_cols='80', query_text_rows='20', **kwargs)

Bases: Form

base_fields = {'job_Result_text': <django.forms.fields.CharField object>}
declared_fields = {'job_Result_text': <django.forms.fields.CharField object>}
error_css_class = 'error'
property media

Return all media required to render the widgets on this form.

required_css_class = 'required'
class ogcapi.forms.OGCAPI_MOAWProcessExecutionForm(*args, request=None, ogcapi_workflow='{}', query_text_cols='80', query_text_rows='20', **kwargs)

Bases: Form

base_fields = {'moaw_workflow_text': <django.forms.fields.CharField object>}
declared_fields = {'moaw_workflow_text': <django.forms.fields.CharField object>}
error_css_class = 'error'
property media

Return all media required to render the widgets on this form.

required_css_class = 'required'
class ogcapi.forms.OGCAPI_ProcessDefinitionForm(*args, request=None, ogcapi_process_definition='{}', query_text_cols='80', query_text_rows='20', **kwargs)

Bases: Form

base_fields = {'process_definition_text': <django.forms.fields.CharField object>}
declared_fields = {'process_definition_text': <django.forms.fields.CharField object>}
error_css_class = 'error'
property media

Return all media required to render the widgets on this form.

required_css_class = 'required'
class ogcapi.forms.OGCAPI_ProcessExecutionForm(*args, request=None, ogcapi_process_execute_request='{}', query_text_cols='80', query_text_rows='50', **kwargs)

Bases: Form

base_fields = {'process_execution_request_text': <django.forms.fields.CharField object>}
declared_fields = {'process_execution_request_text': <django.forms.fields.CharField object>}
error_css_class = 'error'
property media

Return all media required to render the widgets on this form.

required_css_class = 'required'
class ogcapi.forms.TerraNexus_ConfigForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)

Bases: ModelForm

class Meta

Bases: object

fields = ('ogcapi_maxRecordsLimit',)
model

alias of TerraNexus_Config

base_fields = {'ogcapi_maxRecordsLimit': <django.forms.fields.IntegerField object>}
declared_fields = {'ogcapi_maxRecordsLimit': <django.forms.fields.IntegerField object>}
error_css_class = 'error'
property media

Return all media required to render the widgets on this form.

required_css_class = 'required'

ogcapi.models module

Note

Module Details

OGCAPI Model Definition Resource

This Class module is required to configure the base “model” that supports the TerraNexus OGCAPI resources.

This is part of the Model View Controller (MVC) Architecture that underpins Django web applications.

For operational and security reasons the conventional “model” structure supported as standard by Django has been replaced with a mongodb version of this architecture.

This also enables management of the TerraNexus administration database in the same context as all other TerraNexus databases.

Created: 17 November 2020

@author: Dr. Matthew B.J. Purss

class ogcapi.models.TerraNexus_Config(id, ogcapi_maxRecordsLimit, record_id, date_published)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

date_published

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_next_by_date_published(*, field=<django.db.models.fields.DateTimeField: date_published>, is_next=True, **kwargs)
get_previous_by_date_published(*, field=<django.db.models.fields.DateTimeField: date_published>, is_next=False, **kwargs)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
ogcapi_maxRecordsLimit

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

record_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

ogcapi.routing module

Note

Module Details

OGCAPI Routing Module

This Module handles routing of asynchronous tasks to their corresponding resource. This is similar to the WSGI urls.py file but targeting web services.

Created: 26 May 2022

@author: Dr. Matthew B.J. Purss

ogcapi.urls module

Note

Module Details

OGCAPI URL Configuration

The urlpatterns list routes URLs to views for the OGCAPI package. For more information please see: Django Documentation - urls

Created: 25 September 2020

@author: Dr. Matthew B.J. Purss

ogcapi.views module

Note

Module Details

OGCAPI “Views” Module

This module prepares the django views necessary to perform all tasks relevant to OGC API interactions with TerraNexus. This module drives the OGC API Client-Server interface.

Created: 11 September 2020

@author: Dr. Matthew B.J. Purss

class ogcapi.views.BaseWorkflowExecutor(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict)

Bases: object

Base class for workflow executors

__del__()

Cleanup temporary attributes on destruction.

_create_callback_json(callback_id: str, callback_time: datetime, base_href: str, group_name: str) Dict

Create callback JSON and publish to group

Args:

callback_id: The callback ID callback_time: The callback timestamp base_href: The base URL group_name: The WebSocket group name

Returns:

Callback JSON dictionary

_prepare_callback_json() Dict

Prepare callback JSON for workflow notifications

Returns:

Callback JSON dictionary

execute() JsonResponse | HttpResponse

Execute the workflow

Returns:

HTTP response with workflow results

class ogcapi.views.BuildDGGRSProcessor(process_id, job_id, execution_json, prov_chain=None, callback_json=None, logfile='ogcapi_task.log')

Bases: object

A specialized processor for handling the BuildDGGRS process.

This class efficiently creates and configures DGGS reference systems with minimal memory usage.

_build_spatiotemporal_dggrs(params)

Build a SpatioTemporal DGGRS.

_build_surface_dggrs(params)

Build a Surface DGGRS.

_build_volumetric_dggrs(params)

Build a Volumetric DGGRS.

_extract_single_input(input_data)

Extract parameters from a single input object.

_get_dggrs_definition(mongodbname)

Get the definition of a DGGRS from the database.

_get_earth_model_params(earth_model_url, default_a, default_f)

Get the semi-major axis and flattening from the Earth model.

_get_earth_model_url(earth_model)

Get the URL for Earth model parameters.

_process_time_parameter(time_value)

Process time parameter to ensure consistent format.

_store_job_info(params)

Store job information in the database.

_update_progress(progress, message=None)

Update progress in callback JSON and publish to callback group.

build_dggrs()

Build the DGGRS based on the extracted parameters.

execute()

Execute the BuildDGGRS process.

extract_parameters()

Extract processing parameters from the execution JSON.

update_provenance()

Update provenance information for the job.

class ogcapi.views.DGGSZoneDataHandler(request, dggrsID, zoneID, task_utils, collectionID='')

Bases: object

Class for handling DGGS Zone information requests. Encapsulates all the functionality related to retrieving and formatting zone information for different DGGS types.

__del__()

Clean up resources when the object is destroyed

Add ‘next’ pagination links

Add ‘prev’ pagination links

Build links list for response

_create_file_download_response(data: dict) FileResponse | JsonResponse

Create a file download response for large JSON data

Args:

data: The JSON data to save to a file

Returns:

FileResponse for the saved file or JsonResponse with task info

_create_html_response()

Create an HTML response with 3D visualization.

Returns:

Django HTTP response with HTML content

Return type:

HttpResponse

_create_jsonfg_response()

Create a JSON Feature Geometry response.

Returns:

Django JSON response with JSON-FG content

Return type:

JsonResponse

_create_streaming_response(feature_query)

Create a streaming response for very large collections

_determine_return_type()

Determine the requested return type based on query parameters or accepted media type.

Returns:

The return type (‘json’, ‘geojson’, ‘jsonfg’, or ‘html’)

Return type:

str

_estimate_result_size()

Estimate the number of results for a query before executing it. This helps decide whether to use streaming or pagination.

Returns:

Estimated number of records that will match the query

Return type:

int

_get_collection_json(base_href, json_features, number_matched, number_returned)

Create a feature collection JSON object

Parameters:
  • base_href (str) – Base URL for links

  • json_features (list) – List of feature JSON objects

  • number_matched (int) – Total number of features matched by the query

  • number_returned (int) – Number of features returned in this response

Returns:

Feature collection JSON object

Return type:

dict

_get_feature_json(feature_id: str, properties: Dict, base_href: str, return_type: str, getProv: bool = True) Dict

Get feature JSON representation

_get_max_records_limit() int

Get maximum records limit from configuration

_get_zone_data(batch_size=100)

Get zone data with efficient batch processing using Celery tasks with RabbitMQ

Parameters:

batch_size (int, optional) – Number of records to process in each batch, default 100

Returns:

Dictionary containing feature collection data

Return type:

dict

_get_zone_info()

Get zone information based on DGGS type.

Returns:

True if zone information was successfully retrieved, False otherwise

Return type:

bool

_initialize_dggs()

Initialize the appropriate DGGS instance based on type.

Returns:

True if initialization succeeded, False otherwise

Return type:

bool

_initialize_surface_dggs(dggs_params)

Initialize a Surface DGGS instance.

Parameters:

dggs_params (DataFrame) – DataFrame containing DGGS parameters

Returns:

Initialized Surface DGGS instance

Return type:

SurfaceDGGS

_initialize_tesseract_dggs(dggs_params)

Initialize a Tesseract DGGS instance.

Parameters:

dggs_params (DataFrame) – DataFrame containing DGGS parameters

Returns:

Initialized Tesseract DGGS instance

Return type:

TesseractDGGS

_initialize_volumetric_dggs(dggs_params)

Initialize a Volumetric DGGS instance.

Parameters:

dggs_params (DataFrame) – DataFrame containing DGGS parameters

Returns:

Initialized Volumetric DGGS instance

Return type:

VolumetricDGGS

_parse_show_zone_geometry()

Parse “show-geometry” parameter.

_process_batch(batch_ids, features_list, base_href)

Process a batch of feature IDs and add to features list

Parameters:
  • batch_ids (list) – List of feature IDs to process

  • features_list (list) – List to store feature objects

  • base_href (str) – Base URL for feature links

_process_bbox_parameter()

Process bbox parameter for spatial filtering

_process_query_parameters() None

Process query parameters including limit, offset, and filters

_save_file_standard(data: dict) FileResponse

Save data to file using standard json.dump

_save_large_file_incrementally(data: dict) FileResponse

Save large data to file incrementally to avoid memory issues

_send_error_notification(exception)

Send error notification to administrators.

Parameters:

exception (Exception) – The exception that occurred

_transform_to_geojson(feature)

Transform a database feature to GeoJSON format

_validate_collectionID()

Validate the Collection ID.

Returns:

True if the Collection ID is valid or empty, False otherwise

Return type:

bool

_validate_dggrs_id()

Validate the DGGS instance ID.

Returns:

True if the DGGS ID is valid, False otherwise

Return type:

bool

_validate_parameters()

Validate all required parameters

_validate_zone_id()

Validate the Zone ID based on DGGS type.

Returns:

True if the Zone ID is valid, False otherwise

Return type:

bool

handle_request()

Main method to process the request and return appropriate response.

Returns:

Django HTTP response with appropriate content and status

Return type:

HttpResponse

class ogcapi.views.DGGSZoneHandler(request, dggrsID, zoneID, task_utils, collectionID='')

Bases: object

Class for handling DGGS Zone information requests. Encapsulates all the functionality related to retrieving and formatting zone information for different DGGS types.

__del__()

Clean up resources when the object is destroyed

_add_indexed_collections(zone_info, base_href)

Add indexed collections information to the zone info object.

Parameters:
  • zone_info (dict) – The zone info dictionary to add indexed collections to

  • base_href (str) – The base URL for constructing links

Add hyperlinks to the zone info object.

Parameters:
  • zone_info (dict) – The zone info dictionary to add links to

  • base_href (str) – The base URL for constructing links

_add_zone_properties(zone_info)

Add zone properties to the zone info object.

Parameters:

zone_info (dict) – The zone info dictionary to add properties to

_build_zone_info()

Build the complete zone information object for the response. This includes zone properties, links, and related data.

_create_geojson_response()

Create a GeoJSON response.

Returns:

Django JSON response with GeoJSON content

Return type:

JsonResponse

_create_html_response()

Create an HTML response with 3D visualization.

Returns:

Django HTTP response with HTML content

Return type:

HttpResponse

_create_jsonfg_response()

Create a JSON Feature Geometry response.

Returns:

Django JSON response with JSON-FG content

Return type:

JsonResponse

_determine_return_type()

Determine the requested return type based on query parameters or accepted media type.

Returns:

The return type (‘json’, ‘geojson’, ‘jsonfg’, or ‘html’)

Return type:

str

Add hyperlink templates to the zone info object.

Parameters:
  • zone_info (dict) – The zone info dictionary to add links to

  • base_href (str) – The base URL for constructing links

_get_zone_info()

Get zone information based on DGGS type.

Returns:

True if zone information was successfully retrieved, False otherwise

Return type:

bool

_initialize_dggs()

Initialize the appropriate DGGS instance based on type.

Returns:

True if initialization succeeded, False otherwise

Return type:

bool

_initialize_surface_dggs(dggs_params)

Initialize a Surface DGGS instance.

Parameters:

dggs_params (DataFrame) – DataFrame containing DGGS parameters

Returns:

Initialized Surface DGGS instance

Return type:

SurfaceDGGS

_initialize_tesseract_dggs(dggs_params)

Initialize a Tesseract DGGS instance.

Parameters:

dggs_params (DataFrame) – DataFrame containing DGGS parameters

Returns:

Initialized Tesseract DGGS instance

Return type:

TesseractDGGS

_initialize_volumetric_dggs(dggs_params)

Initialize a Volumetric DGGS instance.

Parameters:

dggs_params (DataFrame) – DataFrame containing DGGS parameters

Returns:

Initialized Volumetric DGGS instance

Return type:

VolumetricDGGS

_parse_show_zone_geometry()

Parse “show-geometry” parameter.

_parse_target_zone_only_param()

Parse “target-zone-only” parameter.

_send_error_notification(exception)

Send error notification to administrators.

Parameters:

exception (Exception) – The exception that occurred

_validate_dggrs_id()

Validate the DGGS instance ID.

Returns:

True if the DGGS ID is valid, False otherwise

Return type:

bool

_validate_zone_id()

Validate the Zone ID based on DGGS type.

Returns:

True if the Zone ID is valid, False otherwise

Return type:

bool

handle_request()

Main method to process the request and return appropriate response.

Returns:

Django HTTP response with appropriate content and status

Return type:

HttpResponse

class ogcapi.views.DGGSZoneQueryHandler(request, dggrsID, task_utils)

Bases: object

__del__()

Cleanup temporary attributes on destruction.

_add_bbox_visualization_context()

Add bounding box visualization context for HTML rendering.

_add_parent_zone_visualization()

Add parent zone visualization for HTML rendering.

_build_response_object()

Build the response object structure.

_build_zone_meshes(matched_zoneIds)

#======================================================================= # Build meshes for all returned zones #=======================================================================

_create_streaming_response()

Create a streaming response for very large collections

_estimate_point_generation_complexity(spatioTemporalBbox_df, num_intervals, num_temporal_intervals)

Estimate the computational complexity of point generation.

_execute_bbox_query()

Execute a bounding box query.

_execute_parent_zone_query()

Execute a parent zone query.

_execute_unconstrained_query()

Execute an unconstrained zone query.

_execute_zone_query()

Execute the zone query based on the parameters.

Generate link templates for the response.

Generate links for the response.

_generate_radial_points_sequential_fallback(height_expanded_df, height_steps, radial_range, theta_range, spatial_bounds)

Fallback sequential processing that exactly mirrors the original function logic.

_get_collections()

Get collections for this DGGS.

_get_dggs_instances()

Get available DGGS instances.

_init_collections_and_urls()

Initialize collections and URLs in the context.

_parse_bbox()

Parse bounding box parameter.

_parse_compact_zones()

Parse compact zones parameter.

_parse_content_negotiation()

Parse content negotiation parameters.

_parse_datetime()

Parse datetime parameter for temporal queries.

_parse_datetime_value(datetime_string)

Parse a datetime string into a timestamp value.

_parse_indexed_zones()

Parse “indexed-zones” parameter.

_parse_parent_zone()

Parse parent zone parameter.

_parse_subset()

Parse subset parameter.

_parse_zone_level()

Parse zone level parameter.

_parse_zone_mesh()

Parse “zone-mesh” parameter.

_prepare_response()

Prepare the response based on the query results and requested format.

_process_large_bbox(spatioTemporalBbox_df, num_intervals, num_temporal_intervals)

Process a large bounding box by generating intermediate points.

_process_large_bbox_hybrid(spatioTemporalBbox_df, num_intervals, num_temporal_intervals)

Hybrid version of _process_large_bbox that offloads computationally intensive parts to Celery.

Args:

spatioTemporalBbox_df: DataFrame with columns [‘x’, ‘y’, ‘z’, ‘t’] num_intervals: Number of spatial intervals num_temporal_intervals: Number of temporal intervals

Returns:

List of matched zone IDs

_process_large_bbox_original(spatioTemporalBbox_df, num_intervals, num_temporal_intervals)

Process a large bounding box by generating intermediate points.

Args:

spatioTemporalBbox_df: DataFrame with columns [‘x’, ‘y’, ‘z’, ‘t’] num_intervals: Number of spatial intervals num_temporal_intervals: Number of temporal intervals

Returns:

List of matched zone IDs

_query_zones_in_collections(db_client, collections_list, dggrsID, zone_level, zone_ids)

Query multiple collections for matching zone IDs efficiently.

Args:

db_client: MongoDB client collections_list: List of collections to query dggrsID: DGGS ID string zone_level: Resolution level zone_ids: List of zone IDs to check

Returns:

List of matched zone IDs

_setup_dggs()

Set up the DGGS object based on the DGGS ID.

_traverse_down_levels()

Traverse down DGGS levels from parent to target level.

_validate_datetime_for_zone(zone, instant=None, interval=None)

Validates if a datetime instant or interval overlaps with a zone’s time bounds.

Args:

zone: The zone object with min_time and max_time properties instant: A single timestamp (optional) interval: A tuple of (start, end) timestamps (optional)

Returns:

bool: True if datetime is valid for the zone, False otherwise

handle_request()

Main handler method that processes the request and returns a response.

class ogcapi.views.ExtendedStreamingDataProcessor(chunk_size=10000)

Bases: StreamingDataProcessor

Extended StreamingDataProcessor with additional file format support.

_process_raster_in_chunks(raster_src, processor_func, **kwargs)

Process a raster dataset in chunks to minimize memory usage.

process_geotiff(source, processor_func, **kwargs)

Process a GeoTIFF data source in chunks.

Args:

source: URL or file path to the GeoTIFF data processor_func: Function to call for each chunk **kwargs: Additional arguments to pass to processor_func

process_pts(source, processor_func, **kwargs)

Process a PTS file (3D point cloud) in chunks.

Args:

source: URL or file path to the PTS file processor_func: Function to call for each chunk **kwargs: Additional arguments to pass to processor_func

class ogcapi.views.FindChildZonesExecutor(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict)

Bases: BaseWorkflowExecutor

Executor for FindChildZones process

execute() JsonResponse | HttpResponse

Execute the FindChildZones workflow

class ogcapi.views.FindNeighbourZonesExecutor(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict)

Bases: BaseWorkflowExecutor

Executor for FindNeighbourZones process

execute() JsonResponse | HttpResponse

Execute the FindNeighbourZones workflow

class ogcapi.views.FindParentZonesExecutor(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict)

Bases: BaseWorkflowExecutor

Executor for FindParentZones process

execute() JsonResponse | HttpResponse

Execute the FindParentZones workflow

class ogcapi.views.FindRegisteredZonesExecutor(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict)

Bases: BaseWorkflowExecutor

Executor for FindRegisteredZones process

Build links for the items response

Returns:

List of link objects

_build_response(task_result_json: Dict) JsonResponse | HttpResponse

Build response from process results

Args:

task_result_json: The process results

Returns:

HTTP response with results

_create_feature_object(feature_id: str, feature_data: Dict) Dict

Create GeoJSON feature object

Args:

feature_id: The feature ID feature_data: The feature data

Returns:

GeoJSON feature object

_create_file_download_response(data: Dict) FileResponse

Create a file download response for large JSON data

Args:

data: The JSON data to save to a file

Returns:

FileResponse for the saved file

_determine_feature_geometry(feature_data: Dict) Dict

Determine feature geometry based on workflow options

Args:

feature_data: The feature data

Returns:

GeoJSON geometry object

_estimate_json_size(data: Dict) int

Estimate the size of a JSON object in bytes

Args:

data: The data to estimate the size of

Returns:

Estimated size in bytes

_execute_process() Dict

Execute the FindRegisteredZones process

Returns:

Process results as a dictionary

_get_default_geometry(feature_data: Dict) Dict

Get default geometry based on dggrsID type

Args:

feature_data: The feature data

Returns:

GeoJSON geometry object

_store_feature(feature_id: str, feature_data: Dict) None

Store feature in database

Args:

feature_id: The feature ID feature_data: The feature data

_validate_workflow(workflow_json: Dict, process_definition_json: Dict) None

Validate workflow against process definition

Args:

workflow_json: The workflow definition process_definition_json: The process definition

Raises:

ValueError: If validation fails

execute() JsonResponse | HttpResponse

Execute the FindRegisteredZones workflow

Returns:

HTTP response with the results

class ogcapi.views.GenerateNewZonesExecutor(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict)

Bases: BaseWorkflowExecutor

Executor for GenerateNewZones process

execute() JsonResponse | HttpResponse

Execute the GenerateNewZones workflow

class ogcapi.views.MapDataToZonesExecutor(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict)

Bases: BaseWorkflowExecutor

Executor for MapDataToZones process

execute() JsonResponse | HttpResponse

Execute the MapDataToZones workflow

class ogcapi.views.MapDataToZonesProcessor(process_id, job_id, execution_json, prov_chain=None, callback_json=None, logfile='ogcapi_task.log')

Bases: object

A specialized processor for handling the MapDataToZones process efficiently.

This version completes all missing functionality with a focus on memory efficiency and handling large datasets with minimal resources.

__del__()

Cleanup temporary files on destruction.

_compute_dggs_zones(coord_pairs, resolution)

Compute DGGS zones for coordinate pairs at given resolution using parallel processing optimized for RabbitMQ.

_compute_dggs_zones_sequential(coord_pairs, resolution)

Fallback sequential implementation of DGGS zone computation.

_create_coordinate_grids(transform, width, height)

Create x and y coordinate grids for each pixel.

_create_enhanced_geotiff(input_path, output_path, data_collection_name)

Create an enhanced GeoTIFF with coordinate and DGGS layers.

_encode_dggs_zones(zone_array, resolution)

Encode DGGS zones to integers for raster storage.

Handles large hex values from spatiotemporal DGGS (e.g., “0x4181ef5b00f5b1e00000419d0f611ec5bce4620e34308842ce33ac7f”) which are 256-bit values too large for standard integer types. Also handles invalid/missing zones.

Extract search box coordinates from the input.

_get_dggs_params_for_tasks()

Extract DGGS parameters needed to reconstruct DGGS object in tasks.

_get_task_state_duration(task_states_history, task_id, state, current_time)

Get how long a task has been in a particular state.

_load_dggs_mappings(data_collection_name, prefer_mongodb=True)

Load DGGS zone mappings from MongoDB or JSON file.

_map_features_to_dggs(features, **kwargs)

Map features to DGGS zones.

_map_geotiff_to_dggs(input_path, output_path, data_collection_name)

Create an enhanced GeoTIFF with coordinate and DGGS layers.

_process_collection_source(data_source)

Process a single collection data source.

_process_csv_chunk(rows, header='lon,lat,depth', **kwargs)

Process a chunk of rows from a CSV file.

_process_csv_source(collection_url, primary_source)

Process a CSV data source with streaming to avoid memory issues.

_process_enhanced_geotiff(tiff_path)

Process the enhanced GeoTIFF to extract final results.

_process_geotiff_with_layers(geotiff_url, collection_ID)

Process a GeoTIFF file and create coordinate and DGGS layers without reprojection.

_process_json_chunk(features, **kwargs)

Process a chunk of JSON features and map them to DGGS zones.

_process_json_source(collection_url, primary_source)

Process a JSON data source (GeoJSON or FeatureCollection).

_process_pts_chunk(lines, collection_ID, results)

Process a chunk of lines from a PTS file.

_process_pts_source(collection_url, primary_source)

Process a 3D ASCII point cloud (.pts) file.

_process_wcs_source(collection_url, primary_source)

Process a Web Coverage Service data source.

_reconstruct_zones_from_mongodb(resolution, expected_length)

Reconstruct zone array from MongoDB documents for a specific resolution.

_save_dggs_mappings(data_collection_name, raster_bounds)

Save DGGS zone mappings to MongoDB and JSON backup for later querying.

_store_json_chunk(data_json, chunk_id)

Store a JSON chunk in GridFS.

_transform_coordinates_to_lonlat(x_coords, y_coords, source_crs)

Transform coordinates from source CRS to EPSG:4326.

_update_progress(progress, message=None)

Update progress in callback JSON and publish to callback group.

_wait_for_dggs_completion(expected_chunks_per_resolution, timeout=1800)

Wait for DGGS tasks to complete by polling MongoDB with detailed debugging.

_wait_for_dggs_completion_by_coords(expected_coords_count, resolutions, timeout=1800)

Wait for DGGS tasks to complete by checking coordinate count, not task count.

check_rabbitmq_broker_health()

Check if the RabbitMQ broker is working properly

check_rabbitmq_result_backend_health()

Check if the result backend (separate from RabbitMQ broker) is working

cleanup_rabbitmq_tasks(task_ids, max_age_minutes=45)

Clean up RabbitMQ tasks that have been stuck for too long

debug_rabbitmq_tasks(task_ids)

Debug helper to investigate RabbitMQ task states

execute()

Execute the MapDataToZones process.

extract_parameters()

Extract processing parameters from the execution JSON.

get_encoded_values_for_zones(data_collection_name, zone_ids, resolution)

Get encoded values for specific zone IDs at a given resolution.

Args:

data_collection_name: Name of the data collection zone_ids: List of zone IDs or single zone ID resolution: Resolution level

Returns:

List of encoded values that can be used to query the raster

get_zone_statistics(data_collection_name, resolution=None)

Get statistics about zones in the MongoDB collection.

initialize_dggs()

Initialize the DGGS object based on the DGGRS ID.

log_rabbitmq_queue_status()

Log RabbitMQ queue status for debugging

process_data_source()

Process the data source based on its type and format.

query_zones_by_pattern(data_collection_name, zone_pattern, resolution=None)

Query MongoDB to find encoded values for zones matching a pattern.

Args:

data_collection_name: Name of the data collection zone_pattern: Regex pattern or exact zone_id to match resolution: Specific resolution level (optional)

Returns:

List of dictionaries with zone_id, encoded_value, and resolution

setup_job_database()

Set up the job database entry.

submit_dggs_tasks_to_rabbitmq(chunk_tasks, max_concurrent_submissions=20)

Submit tasks to RabbitMQ with rate limiting and error handling

subset_raster_by_zones(tiff_path, data_collection_name, zone_ids, resolution, output_path=None)

Subset a raster based on DGGS zone IDs by creating a mask from encoded values.

Args:

tiff_path: Path to the enhanced GeoTIFF data_collection_name: Name of the data collection zone_ids: List of zone IDs to include in subset resolution: Resolution level to use for subsetting output_path: Optional output path for subsetted raster

Returns:

Tuple of (subset_data, mask, metadata) or writes to output_path

update_provenance()

Update provenance information for the job.

class ogcapi.views.OGCAPICollectionItemsHandler(request, collection_id: str, task_utils)

Bases: object

Handler for OGC API Collection Items requests

__del__()

Cleanup temporary attributes on destruction.

Add ‘next’ pagination links

Add ‘prev’ pagination links

_build_base_urls() None

Build base URLs for links in the response

Build links list for response

_check_authentication() bool

Check if the user is authenticated for workflow collections

Returns:

bool: True if authenticated, False otherwise

_create_file_download_response(data: Dict) FileResponse

Create a file download response for large JSON data

Args:

data: The JSON data to save to a file

Returns:

FileResponse for the saved file

_create_streaming_response(feature_query)

Create a streaming response for very large collections

_estimate_json_size(data: Dict) int

Estimate the size of a JSON object in bytes

Args:

data: The data to estimate the size of

Returns:

Estimated size in bytes

_get_collection_json(base_href: str, json_features: List, number_matched: int, number_returned: int) Dict

Get collection metadata

_get_feature_json(feature_id: str, properties: Dict, base_href: str, return_type: str) Dict

Get feature JSON representation

_get_max_records_limit() int

Get maximum records limit from configuration

_handle_content_negotiation() None

Process content negotiation to determine return format

_handle_static_collection() JsonResponse | HttpResponse

Handle requests for static feature collections

Returns:

HTTP response with collection items

_handle_workflow_collection() JsonResponse | HttpResponse

Handle requests for workflow collections

Returns:

HTTP response with workflow execution results

_is_workflow_collection() bool

Check if this is a workflow collection or a static collection

Returns:

bool: True if this is a workflow collection, False otherwise

_process_bbox_parameter() None

Process the bbox (bounding box) query parameter

_process_query_parameters() None

Process query parameters including limit, offset, and filters

_update_query_with_bbox(bbox_query: List[Dict]) None

Update the database query with bbox conditions

process_request() JsonResponse | HttpResponse

Process the collection items request

Returns:

HTTP response (JSON or HTML) depending on content negotiation

class ogcapi.views.ProcessExecutor(request, processID, logfile='ogcapi_task.log')

Bases: object

A class to handle OGC API Process Execution workflows in a modular, efficient manner.

This executor handles different process types and ensures efficient resource usage even with limited CPU and memory.

Add output-specific links to response JSON.

Construct links for process response.

_determine_content_media_type()

Determine content media type based on headers and process description.

_determine_execution_mode()

Determine if sync or async execution based on headers and process options.

_extract_process_execution_json()

Extract and parse the process execution JSON from the request.

_generate_job_id()

Generate a unique job ID for this process execution.

_get_process_description()

Retrieve the process description from the database.

_handle_callback_success()

Send success notifications to callbacks.

_handle_process_failure(exception)

Handle process execution failure and update status.

_make_json_serializable(obj)

Make objects JSON serializable by converting AsyncResult objects.

_process_map_data_to_zones()

Execute the MapDataToZones process.

_register_provenance_activity()

Register provenance activity for the job.

_register_provenance_agents()

Register provenance agents for the job.

_register_provenance_entity()

Register provenance entity for the job.

_send_callback_notifications(callbackId)

Send callback notifications to subscribers.

_setup_callback_infrastructure()

Setup callback infrastructure for async processes.

_setup_job_database()

Setup job database collections for storing results.

_setup_provenance_chain()

Setup the provenance chain for tracking execution.

_setup_query_parameters()

Extract query parameters from the request.

_store_process_result(process_json_response)

Store process results in the database.

_update_provenance_on_completion()

Update provenance information upon successful completion.

_validate_execution_document()

Validate the execution document against schema requirements.

_validate_ogcapi_execute_document(execution_doc)

Validate an OGC API execute document.

execute_process()

Main method to execute the process workflow.

class ogcapi.views.ProcessExecutorWithStreaming(request, processID, logfile='ogcapi_task.log')

Bases: ProcessExecutor

Extended ProcessExecutor that incorporates the StreamingDataProcessor for handling large data files efficiently.

_add_output_value(response_json, output_name, task_result)

Add output value to response based on process type and content media type.

_add_results_to_response(response_json, task_result)

Add results to the response JSON based on content media type and output structure.

_add_single_output(response_json, output_name, task_result)

Add single output to response.

_make_json_serializable(obj)

Make objects JSON serializable by converting AsyncResult objects.

_process_build_dggrs()

Execute the BuildDGGRS process.

_process_map_data_to_zones()

Execute the MapDataToZones process with streaming data support.

This extends the parent implementation to use StreamingDataProcessor for handling large datasets.

_process_publish_to_immutable_catalogue()

Execute the PublishToImmutableCatalogue process.

execute_process()

Main method to execute the process workflow.

class ogcapi.views.PublishToImmutableCatalogueProcessor(process_id, job_id, execution_json, prov_chain=None, callback_json=None, base_href='', logfile='ogcapi_task.log')

Bases: object

A specialized processor for handling the PublishToImmutableCatalogue process.

This class efficiently publishes feature data to an immutable catalogue with minimal memory usage.

_calculate_feature_bbox(geometry_type, coordinates)

Calculate the bounding box for a feature geometry.

_extract_single_input(input_data)

Extract parameters from a single input object.

_get_dggs_zone_ids(item_geojson, dggrs_id, refinement_level)

Get DGGS zone IDs for a feature.

_get_feature_json(collection_id, feature_id, feature_properties, base_url, getProv=False, fgjson_flag=False)

Get the GeoJSON representation of a feature.

_store_job_info(process_params)

Store job information in the database.

_update_progress(progress, message=None)

Update progress in callback JSON and publish to callback group.

_upload_to_facts_api(feature_upload_list, process_params)

Upload features to FACTS API in appropriately sized chunks.

execute()

Execute the PublishToImmutableCatalogue process.

extract_parameters()

Extract processing parameters from the execution JSON.

publish_data()

Publish data to the immutable catalogue.

update_provenance()

Update provenance information for the job.

class ogcapi.views.StreamingDataProcessor(chunk_size=10000)

Bases: object

Class for handling large data files with minimal memory usage.

This processor can handle very large files by processing them in chunks without loading the entire file into memory at once.

Extract the ‘next’ link from JSON response if it exists.

_find_features_in_json(data, processor)

Recursively search for features in a JSON structure.

Args:

data: The JSON data to search processor: The processor object for logging

Returns:

List of feature objects or empty list if none found

_get_next_page_from_url(url)

Extract and increment page parameters from URL.

_process_buffer(buffer, processor_func, current_count, max_count, **kwargs)

Process complete JSON objects from a buffer and return remaining partial data.

Returns:

tuple: (remaining_buffer, features_processed_count, next_url)

_process_json_data(data, url, processor_func, kwargs, processor, current_count, max_count)

Process JSON data and extract features.

Args:

data: The JSON data to process url: The URL the data was retrieved from processor_func: Function to call for each chunk kwargs: Additional arguments to pass to processor_func processor: The processor object for logging current_count: Current features processed count max_count: Maximum features to process

Returns:

Next URL if available, otherwise None

_process_raster_in_chunks(raster_src, processor_func, **kwargs)

Process a raster dataset in chunks to minimize memory usage.

_process_sub_url(url, processor_func, kwargs, processor, remaining_features)

Process a sub-URL for a smaller area.

Args:

url: The URL to process processor_func: Function to call for processing kwargs: Additional arguments processor: The processor object remaining_features: Maximum features to process

Returns:

Number of features processed

_split_bbox_url(url)

Split a bbox URL into smaller areas to handle timeouts from large area requests.

Args:

url: The URL with a bbox parameter

Returns:

List of URLs with smaller bboxes

_store_complete_response(url, response, processor)

Store the complete JSON response in tmp_data collection.

_store_standardized_geojson(geojson_data, chunk_id, processor)

Store standardized GeoJSON in GridFS for proper processing by map_data.

process_csv(source, processor_func, **kwargs)

Process a CSV data source in chunks.

Args:

source: URL or file path to the CSV data processor_func: Function to call for each chunk **kwargs: Additional arguments to pass to processor_func

process_geotiff(source, processor_func, **kwargs)

Process a GeoTIFF data source in chunks.

Args:

source: URL or file path to the GeoTIFF data processor_func: Function to call for each chunk **kwargs: Additional arguments to pass to processor_func

process_json(source, processor_func, **kwargs)

Process a JSON data source in chunks with pagination support and retry logic.

Args:

source: URL or file path to the JSON data processor_func: Function to call for each chunk **kwargs: Additional arguments to pass to processor_func

class ogcapi.views.WorkflowExecutorFactory

Bases: object

Factory for creating workflow executors

static create(process_id: str, collection_id: str, workflow_json: Dict, request, context: Dict) BaseWorkflowExecutor | None

Create a workflow executor based on process ID

Args:

process_id: The process ID collection_id: The collection ID workflow_json: The workflow definition request: The HTTP request context: The context dictionary

Returns:

BaseWorkflowExecutor: The appropriate workflow executor or None if not supported

class ogcapi.views.WorkflowManager(collection_id: str)

Bases: object

Manager for workflow operations

__del__()

Cleanup temporary attributes on destruction.

get_process_id() str

Get the process ID associated with the workflow

Returns:

The process ID

get_workflow_definition() Dict

Get the workflow definition

Returns:

The workflow definition as a dictionary

ogcapi.views._check_TerraNexusAuthentication(request, returnTokens=False)

Note

Function Details

TerraNexus Authentication Checker

Internal function that checks/verifies the user is authenticated to perform certain OGC API Operations

Parameters:
  • request (request-object, required) – The html request object.

  • returnTokens (boolean, optional, default=False) – Flag to select whether or not the access and refresh tokens are returned with the response.

Returns:

user_authenticated – Flag response indicating whether or not the user is authenticated.

Return type:

boolean

ogcapi.views._executeBuildDGGRS_process(processID, jobID, processExecution_json, sync_flag=True, provChain={}, callback_json={})

Note

Function Details

Internal function to execute the `BuildDGGRS` OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) – Process Execution Document - following the OGC API - Processes execute document schema.

  • sync_flag (boolean, optional, default=True) – Flag to indicate synchronous or asynchronous processing.

  • provChain (Dictionary-Like, optional) – Provenance Chain information necessary to log Provenance.

  • callback_json (JSON, optional) – Callback message (in JSON format) to send to the Process Callback Listeners.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

ogcapi.views._executeFindChildZones_process(processID, jobID, processExecution_json, sync_flag=True)

Note

Function Details

Internal function to execute the `FindChildZones` OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) – Process Execution Document - following the OGC API - Processes Execute schema.

  • sync_flag (boolean, optional, default=True) – Flag to indicate synchronous or asynchronous processing.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

ogcapi.views._executeFindNeighbourZones_process(processID, jobID, processExecution_json, sync_flag=True)

Note

Function Details

Internal function to execute the `FindNeighbourZones` OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) –

    Process Execution Document - following the OGC API - Processes Execute schema.

  • sync_flag (boolean, optional, default=True) – Flag to indicate synchronous or asynchronous processing.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

ogcapi.views._executeFindParentZones_process(processID, jobID, processExecution_json, sync_flag=True)

Note

Function Details

Internal function to execute the `FindParentZones` OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) –

    Process Execution Document - following the OGC API - Processes Execute schema.

  • sync_flag (boolean, optional, default=True) – Flag to indicate synchronous or asynchronous processing.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

ogcapi.views._executeFindRegisteredZones_process(processID, jobID, processExecution_json, callback_json)

Note

Function Details

Internal function to execute the “FindRegisteredZones” OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) – Process Execution Document - following the OGC API - Processes “execute” schema.

  • callback_json (JSON, required) – Callback message (in JSON format) to send to the Process Callback Listeners.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

ogcapi.views._executeGenerateNewZones_process(processID, jobID, processExecution_json, sync_flag=True)

Note

Function Details

Internal function to execute the `GenerateNewZones` OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) –

    Process Execution Document - following the OGC API - Processes Execute schema.

  • sync_flag (boolean, optional, default=True) – Flag to indicate synchronous or asynchronous processing.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

ogcapi.views._executeMapDataToZones_process(processID, jobID, processExecution_json, sync_flag=True, provChain={}, callback_json={})

Note

Function Details

Internal function to execute the `MapDataToZones` OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) –

    Process Execution Document - following the OGC API - Processes execute document schema.

  • sync_flag (boolean, optional, default=True) – Flag to indicate synchronous or asynchronous processing.

  • provChain (Dictionary-Like, optional) – Provenance Chain information necessary to log Provenance.

  • callback_json (JSON, optional) – Callback message (in JSON format) to send to the Process Callback Listeners.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

ogcapi.views._executePublishToImmutableCatalogue_process(processID, jobID, processExecution_json, sync_flag=True, provChain={}, callback_json={}, base_href='')

Note

Function Details

Internal function to execute the `PublishToImmutableCatalogue` OGC API Process

Parameters:
  • processID (str, required) – Unique identifier of the process.

  • jobID (str, required) – Unique identifier of the process execution job.

  • processExecution_json (JSON, required) –

    Process Execution Document - following the OGC API - Processes execute document schema.

  • sync_flag (boolean, optional, default=True) – Flag to indicate synchronous or asynchronous processing.

  • provChain (Dictionary-Like, optional) – Provenance Chain information necessary to log Provenance.

  • callback_json (JSON, optional) – Callback message (in JSON format) to send to the Process Callback Listeners.

Returns:

task_result_json – Results from the process execution job in JSON format.

Return type:

JSON

Generate feature links statically.

Parameters:
  • base_href (str) – Base URL for feature links

  • feature_id (str) – Feature identifier

Returns:

List of link objects

Return type:

list

ogcapi.views._get_required_feature_fields(collection_id)

Determine the fields required for feature JSON generation. This could be cached for better performance.

Parameters:

collection_id (str) – Collection identifier

Returns:

List of required fields

Return type:

list

ogcapi.views._initialise_static_process_descriptions(base_href)

Note

Function Details

Internal function to initialise the TerraNexus “STATIC” OGC API Process Definitions.

Parameters:

base_href (str, required) – The base uri of TerraNexus - This is used to generate correct standardised OGC API URI’s.

Returns:

process_description_list – A list of all registered OGC API Process Descriptions hosted by TerraNexus

Return type:

list

ogcapi.views._process_description_error(process_element, invalid_reason, validation_schema)

Note

Function Details

Internal function to send formatted error messages from the OGC API Document validations

Parameters:
  • process_element (str, required) – OGC API Document Field.

  • invalid_reason (str, required) – OGC API Document validation Error Reason.

  • validation_schema (str, required) – OGC API Document schema.

Returns:

ValidationError – A Formatted ValidationError Message includeing the process_element, invalid_reason and validation_schema information.

Return type:

str

ogcapi.views._process_properties_efficiently(properties_dict)

Process feature properties efficiently.

Parameters:

properties_dict (dict) – Dictionary of feature properties

Returns:

Processed properties dictionary

Return type:

dict

ogcapi.views._validate_ogcapi_applicationPackage_description(process_description_json)

Note

Function Details

Internal function to validate the OGC API ApplicationPackage Definition Document against the OGC API - Processes Application Package Schema [Vretanos, 2020].

Parameters:

process_description_json (str, required) – OGC API Processes - Part 2 - Deploy, Replace, Undeploy (DRU) “Application Package Description” json document.

ogcapi.views._validate_ogcapi_execute_document(execute_json)

Note

Function Details

Internal function to validate the OGC API Execute Document against the [Pross and Vretanos, 2021] schema.

Parameters:

execute_json (str, required) – OGC API Processes - Part 1 - Core “Execute” json document.

ogcapi.views._validate_ogcapi_input_description(input_description)

Note

Function Details

Internal function to validate the OGC API Input Definition Document snippit against the [Pross and Vretanos, 2021] schema.

Parameters:

input_description (str, required) – OGC API Processes - Part 1 - Core “Input Description” json document snippit.

ogcapi.views._validate_ogcapi_input_value(input_value)

Note

Function Details

Internal function to validate the OGC API Input values against the [Pross and Vretanos, 2021] schema.

Parameters:

input_value (str, required) – OGC API Processes - Part 1 - Core “Input Value”.

ogcapi.views._validate_ogcapi_output_description(output_description)

Note

Function Details

Internal function to validate the OGC API Output Definition Document snippit against the [Pross and Vretanos, 2021] schema.

Parameters:

output_description (str, required) – OGC API Processes - Part 1 - Core “Output Description” json document snippit.

ogcapi.views._validate_ogcapi_output_value(output_value)

Note

Function Details

Internal function to validate the OGC API Output Value snippit against the [Pross and Vretanos, 2021] schema

Parameters:

output_value (str, required) – OGC API Processes - Part 1 - Core “Output Value” json document snippit.

ogcapi.views._validate_ogcapi_process_description(process_description_json)

Note

Function Details

Internal function to validate the OGC API Process Definition Document against the [Pross and Vretanos, 2021] schema.

Parameters:

process_description_json (str, required) – OGC API Processes - Part 1 - Core “Process Description” json document.

ogcapi.views._validate_ogcapi_workflow_description(workflow_execute_json, processDescription_json)

Note

Function Details Internal function to validate the OGC API Workflow Definition Document against the [St-Louis, 2021] schema.

Parameters:
  • workflow_execute_json (str, required) – OGC API Processes - Part 3 - Workflows “Execute” json document.

  • processDescription_json (str, required) – OGC API Processes - Part 1 - Core “Description” json document.

ogcapi.views.api_definition(request, *args, **kwargs)

Note

Function Details

TerraNexus OGC API Definition Document

Parameters:

request (request-object, required) – The html request object.

Returns:

ogcapi_document – The OGC API Definition Document in JSON format.

Return type:

JSON

ogcapi.views.check_file_status(request, task_id)

View to check the status of a file generation task

ogcapi.views.check_task_status(request, *args, **kwargs)

Check the status of an async task using RPC backend

ogcapi.views.collection_dggs_definition(request, *args, **kwargs)

Note

Function Details

Details of the Selected DGGS Enabled Collection for the selected DGGS Instance.

Structural definition and links to OGC API Resources implemented on this server for the selected DGGS Reference System. This describes the key parameters and structure of the selected DGGS Reference System as specified by OGC Abstract Specification Topic 21 v2.0 - Part 1 [Gibb, 2021] (ISO/19170-1 [Gibb, 2021])

The key components to this DGGS_RS definition (defined in the response schema) include:

  • dggsRsDescription

    • The informative description of the selected DGGS_RS and cananonical source.

  • dggsRsStructure

    • The Key elements used to describe the structure of the selected DGGS. These include:

      • referenceSystemType

      • gridConstraint

      • zoneGeometry

      • surfaceInterpolation

      • refinementStrategy

      • refinementRatio

      • dggsRsZoneClasses

    • The DGGS_RS Heirarchy of Zone Classes for the selected DGGS_RS implementation. This describes the DGGS zone heirarchy in a similar fashion to the Tile Matrix Set of the OGC API Tiles.

  • links

    • Links to further resources directly associated with this DGGS_RS Resource.

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

  • dggrsID (str, required) – The unique identifier of the DGGS Instance.

Returns:

dggs_definition – The OGC API DGGS Definition Document following the draft dggsDefinition schema defined by Purss and St-Louis [2023]

Return type:

JSON

ogcapi.views.collection_dggs_definition_list(request, *args, **kwargs)

Note

Function Details

List of the DGGS Instances Enabled for the selected Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

Returns:

ogcapi_landingPage_Document – The list of DGGS Instances Hosted by TerraNexus that are enabled/mapped for the selected Collection as an OGC API Landing Page Document following the OGC API - Common LandingPage schema

Return type:

JSON

ogcapi.views.collection_dggs_zone_data(request, *args, **kwargs)

Note

Function Details

Returns the Data contained by/mapped to the selected DGGS Zone of the Selected DGGS Enabled Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

  • dggrsID (str, required) – The unique identifier of the DGGS Instance.

  • zoneID (str, required) – The unique identifier of the DGGS Zone.

ogcapi.views.collection_dggs_zone_info(request, *args, **kwargs)

Note

Function Details

Details of the selected DGGS Zone of the Selected DGGS Enabled Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

  • dggrsID (str, required) – The unique identifier of the DGGS Instance.

  • zoneID (str, required) – The unique identifier of the DGGS Zone.

Returns:

dggs_zone_definition – The OGC API DGGS Zone Definition Document following the schema defined by Purss and St-Louis [2023]

Return type:

JSON

ogcapi.views.collection_dggs_zones_list(request, *args, **kwargs)

Note

Function Details

List of all DGGS Zones mapped to Features of this Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

  • dggrsID (str, required) – The unique identifier of the DGGS Instance.

Returns:

dggs_zones – The OGC API DGGS Zones List Document following the schema defined by Purss and St-Louis [2023]

Return type:

JSON

ogcapi.views.collection_items_list(request, *args, **kwargs)

Note

Function Details Details of the Features contained by the selected OGC API Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

Returns:

ogcapi_FeatureCollection – The list of available data items (features) contained by the specified collection following the OGC API - Features - Part 1: Core [Portele et al., 2022] Feature Collection (Items) Schema

Return type:

JSON or HTML

ogcapi.views.collection_items_return(request, *args, **kwargs)

Note

Function Details

Data Return for the selected Feature of the selected OGC API Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

  • itemID (str, required) – The unique identifier of the OGC API Collection Item.

Returns:

ogcapi_Feature – The details of the specified item (feature) contained by the specified collection following the OGC API - Features - Part 1: Core [Portele et al., 2022] Feature (Item) Schema

Return type:

JSON

ogcapi.views.collection_landing_page(request, *args, **kwargs)

Note

Function Details

Details of the selected OGC API Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

Returns:

ogcapi_collections – The list of available data collections registered to the TerraNexus OGC API Server following the OGC API - Features - Part 1: Core [Portele et al., 2022] Collection Details Schema

Return type:

JSON

ogcapi.views.collection_queryables_list(request, *args, **kwargs)

Note

Function Details

Details of the Queryable Fields for Features contained by the selected OGC API Collection

Parameters:
  • request (request-object, required) – The html request object.

  • collectionID (str, required) – The unique identifier of the OGC API Collection.

Returns:

ogcapi_queryables – The list of available data collection Queryable Fields registered to the TerraNexus OGC API Server following the OGC API - Features - Part 3: Filtering [Vretanos and Portele, 2019] Queryables Schema

Return type:

JSON

ogcapi.views.collections(request, *args, **kwargs)

Note

Function Details

List of all OGC API Feature Collections currently registered to the TerraNexus OGC API Server

Parameters:

request (request-object, required) – The html request object.

Returns:

ogcapi_collections – The list of available data collections registered to the TerraNexus OGC API Server following the OGC API - Common - Part 2: Geospatial Data [Heazel, 2022] Collections Schema

Return type:

JSON

ogcapi.views.conformance(request, *args, **kwargs)

Note

Function Details

OGC API Conformance Classes supported and implemented by the TerraNexus OGC API

Parameters:

request (request-object, required) – The html request object.

Returns:

conformanceDeclaration – The OGC API Conformance Declaration Statement following the OGC API Common Conformance Schema

Return type:

JSON

ogcapi.views.dggs_definition(request, *args, **kwargs)

Note

Function Details

Structural definition and links to OGC API Resources implemented on this server for the selected DGGS Reference System. This describes the key parameters and structure of the selected DGGS Reference System as specified by OGC Abstract Specification Topic 21 v2.0 - Part 1 [Gibb, 2021] (ISO/19170-1 [Gibb, 2021])

The key components to this DGGS_RS definition (defined in the response schema) include:

  • dggsRsDescription

    • The informative description of the selected DGGS_RS and cananonical source.

  • dggsRsStructure

    • The Key elements used to describe the structure of the selected DGGS. These include:

      • referenceSystemType

      • gridConstraint

      • zoneGeometry

      • surfaceInterpolation

      • refinementStrategy

      • refinementRatio

      • dggsRsZoneClasses

    • The DGGS_RS Heirarchy of Zone Classes for the selected DGGS_RS implementation. This describes the DGGS zone heirarchy in a similar fashion to the Tile Matrix Set of the OGC API Tiles.

  • links

    • Links to further resources directly associated with this DGGS_RS Resource.

Parameters:
  • request (request-object, required) – The html request object.

  • dggrsID (str, required) – The unique identifier of the Discrete Global Grid Reference System Instance.

Returns:

dggs_definition – The OGC API DGGS Definition Document following the draft dggsDefinition schema defined by Purss and St-Louis [2023]

Return type:

JSON

ogcapi.views.dggs_definition_doc(request, *args, **kwargs)
ogcapi.views.dggs_definition_list(request, *args, **kwargs)

Note

Function Details

List of DGGS Instances implemented and available for use via the TerraNexus OGC API Interface.

Parameters:

request (request-object, required) – The html request object.

Returns:

ogcapi_landingPage_Document – The list of DGGS Instances Hosted by TerraNexus as an OGC API Landing Page Document following the OGC API - Common LandingPage schema

Return type:

JSON

ogcapi.views.dggs_zone_data(request, *args, **kwargs)

Note

Function Details

Returns the Data mapped to the selected DGGS Zone of the Selected DGGS

Parameters:
  • request (request-object, required) – The html request object.

  • dggrsID (str, required) – The Unique Identifier for a TerraNexus DGGS Instance.

  • zoneID (str, required) – The Unique Identifier for a TerraNexus DGGS Zone.

ogcapi.views.dggs_zone_data_status(request, *args, **kwargs)

Check the status of an async task using RPC backend

ogcapi.views.dggs_zone_info(request, *args, **kwargs)

Note

Function Details

Zone Details of the Selected DGGS

Parameters:
  • request (request-object, required) – The html request object.

  • dggrsID (str, required) – The Unique Identifier for a TerraNexus DGGRS Instance.

  • zoneID (str, required) – The Unique Identifier for a TerraNexus DGGS Zone.

ogcapi.views.dggs_zones_list(request, *args, **kwargs)

Note

Function Details

List of all (or a subset of) DGGS Zones

Parameters:
  • request (request-object, required) – The html request object.

  • dggrsID (str, required) – The Unique Identifier for a TerraNexus DGGS Instance.

ogcapi.views.download_generated_file(request, filename)

View to download a generated file

ogcapi.views.get_collection_crs(earth_model='CRS84')

Note

Function Details

Utility function to get the collection Coordinate Reference System (CRS) details from a given Earth Model.

Parameters:

earth_model (str) – The Earth Model to retrieve the CRS definition for a data collection response. [Default = “CRS84”]

Returns:

crs_uri – Standardised uri to the definition of the specified Earth Model.

Return type:

uri

ogcapi.views.get_collection_json(collection, base_href, dggs_list=[])
ogcapi.views.get_dggrs_definition(dggrsID, uri='https://terranexus.pangaeainnovations.com/ogcapi/dggs')
ogcapi.views.get_dggs_instances()

Note

Function Details

Utility function to retrieve all DGGS instances from the database.

Returns:

dggs_list – List of Registered DGGS Instances currently available through TerraNexus

Return type:

list

ogcapi.views.get_feature_json(collectionID, featureID, featurePropertiesDict, base_href, getProv=True, fgjson_flag=False, task_utils=None)

Generate a feature JSON representation with optimized performance.

Parameters:
  • collectionID (str) – Collection identifier

  • featureID (str) – Feature identifier

  • featurePropertiesDict (dict) – Dictionary of feature properties

  • base_href (str) – Base URL for feature links

  • getProv (bool, optional) – Whether to include provenance information, default True

  • fgjson_flag (bool, optional) – Whether to return feature geometry JSON format, default False

  • task_utils (object, optional) – DGGS_Tools instance to reuse, default None

Returns:

Feature JSON representation

Return type:

dict

ogcapi.views.handle_zone_query(request, dggrsID)

Entry point function to handle DGGS zone queries.

ogcapi.views.landing_page(request, *args, **kwargs)

Note

Function Details

TerraNexus OGC API Landing Page

Parameters:

request (request-object, required) – The html request object.

ogcapi.views.process_callback_details(request, *args, **kwargs)

Note

Function Details

details of the specified OGC API Process Callback.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

  • callbackID (str, required) – The unique identifier of the OGC API Process Callback.

ogcapi.views.process_callback_failed(request, *args, **kwargs)

Note

Function Details

“Failed” endpont of the specified OGC API Process Callback.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

  • callbackID (str, required) – The unique identifier of the OGC API Process Callback.

ogcapi.views.process_callback_inprogress(request, *args, **kwargs)

Note

Function Details “in-Progress” endpont of the specified OGC API Process Callback.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

  • callbackID (str, required) – The unique identifier of the OGC API Process Callback.

ogcapi.views.process_callback_list(request, *args, **kwargs)

Note

Function Details

Listing of OGC API Process Callbacks registered on TerraNexus. These callbacks provide an asynchronous way to receive results and status information from long running process jobs.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

ogcapi.views.process_callback_success(request, *args, **kwargs)

Note

Function Details

“Success” endpont of the specified OGC API Process Callback.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

  • callbackID (str, required) – The unique identifier of the OGC API Process Callback.

ogcapi.views.process_description(request, *args, **kwargs)

Note

Function Details

TerraNexus OGC API Process Details Page

  • GET request
    • Display the details and definition of the specified OGC API Process registered on the TerraNexus OGC API Server.

    • OGC API Processes - Part 1 Core Pross and Vretanos [2021]

  • PUT request
    • Update the Process Definition of the specified OGC API Process registered on the TerraNexus OGC API Server.

    • OGC API Processes - Part 2 Deploy, Replace, Undeploy (DRU) Vretanos [2020]

    • Access to this OGC API Endpoint Method is restricted to Authorized Users.

  • DELETE request
    • Delete/Undeploy the specified Process from the TerraNexus OGC API Server.

    • OGC API Processes - Part 2 Deploy, Replace, Undeploy (DRU) Vretanos [2020]

    • Access to this OGC API Endpoint Method is restricted to Authorized Users.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

ogcapi.views.process_execution(request, *args, **kwargs)

Note

Function Details

TerraNexus OGC API Process Execution Page

  • POST request
    • POST an OGC API Process Execution package to the specified Process on the TerraNexus OGC API Server.

    • Execution can be performed in both _Synchronous_ and _Asynchronous_ modes as defined in OGC API Processes - Part 1 Core Pross and Vretanos [2021]

    • If the execute document follows the OGC API Processes - Part 1 Core schema the execution is a standard Process execution.

    • If the execute docuemt follows the extended format schema described in OGC API Processes - Part 3 Workflows the execution is a Workflow execution.

  • Access to this OGC API Endpoint is restricted to Authorized Users.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

ogcapi.views.process_job_details(request, *args, **kwargs)

Note

Function Details

DGGS Specific OGC API Process Job Details Page.

GET request = Returns Status of the selected Job POST request = Registers an update to this process DELETE request = Cancel and Dismiss the selected Job from the Server.

Parameters:
  • request (request-object, required) – The html request object.

  • jobID (str, required) – The unique identifier of the OGC API Process Job.

ogcapi.views.process_job_result_details(request, *args, **kwargs)

Note

Function Details

Result Status of the selected OGC API Process Job

Parameters:
  • request (request-object, required) – The html request object.

  • jobID (str, required) – The unique identifier of the OGC API Process Job.

  • resultID (str, required) – The unique identifier of the result contained by the OGC API Process Job details.

ogcapi.views.process_job_results(request, *args, **kwargs)

Note

Function Details

Result Status of the selected OGC API Process Job

Parameters:
  • request (request-object, required) – The html request object.

  • jobID (str, required) – The unique identifier of the OGC API Process Job.

ogcapi.views.process_jobs_list(request, *args, **kwargs)

Note

Function Details

List of all OGC API Process Jobs currently registered to the TerraNexus OGC API Server GET request = Returns the list of all registered jobs POST request = Registers a new Job to this Process

Parameters:

request (request-object, required) – The html request object.

ogcapi.views.process_workflows_collection_details(request, *args, **kwargs)
ogcapi.views.process_workflows_collections(request, *args, **kwargs)
ogcapi.views.process_workflows_details(request, *args, **kwargs)

Note

Function Details

Modular OGC API Workflow (MOAW) Management Page.

GET request = Returns Details of the selected Workflow Process following the OGC API - Processes Workflow Definition Schema

Note

The url endpoint that drives this view function (i.e. {root}/processes/{processID}/workflows/{workflowID} ) is not an Official OGC API - Processes endpoint.

It does provide a useful resource, however, and this endpoint may be proposed to the OGC API - Processes Standards Working Group for inclusion in the next update to the standard.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

  • workflowID (str, required) – The unique identifier of the OGC API Processes Workflow.

Returns:

workflowDefinition – The Worflow Definition Document following the following the OGC API - Processes Schema

Return type:

JSON

ogcapi.views.process_workflows_list(request, *args, **kwargs)

Note

Function Details

List of Modular OGC API Workflows registered to the selected OGC API Process and DGGS Instance registered on the TerraNexus OGC API Server.

Note

The url endpoint that drives this view function (i.e. {root}/processes/{processID}/workflows ) is not an Official OGC API - Processes endpoint.

It does provide a useful resource, however, and this endpoint may be proposed to the OGC API - Processes Standards Working Group for inclusion in the next update to the standard.

Parameters:
  • request (request-object, required) – The html request object.

  • processID (str, required) – The unique identifier of the OGC API Process.

ogcapi.views.processes_listing(request, *args, **kwargs)

Note

Function Details

TerraNexus OGC API Processes Landing Page

  • GET Request
    • List of OGC API Processes available on the TerraNexus OGC API Server.

    • OGC API Processes - Part 1 - Core Pross and Vretanos [2021]

  • POST Request
    • Deploy a new OGC API Process Definition to the TerraNexus OGC API Server.

    • OGC API Processes - Part 2 - Deploy, Replace, Undeploy (DRU) Vretanos [2020]

Parameters:

request (request-object, required) – The html request object.

ogcapi.views.serialize_for_celery(obj)

Hybrid serialization approach that combines bson.json_util with custom handling.

Parameters:

obj (object) – The object to make JSON serializable

Returns:

The JSON serializable object

Return type:

object

ogcapi.views.timeout(seconds)

ogcapi.views tasks

ogcapi.views.find_cells_task(mongodbname, search_box, res_min=0, res_max=1, search_type='search_box', construct_cells=True, equalise_cells=True, generate_cell_mesh_flag=False)

Note

Function Details

Celery Task to find Surface DGGS Zones in parallel.

Parameters:
  • mongodbname (str, required) – Name of the DGGS database to query for DGGS Zones (i.e. the dggrsID)

  • search_box (array-like, required) – Search box to use to find the DGGS Zones of interest

  • res_min (int, optional) – Minimum DGGS Resolution to search for zones within the Search Box [Default = 0]

  • res_max (int, optional) – Maximum DGGS Resolution to search for zones within the Search Box [Default = 1]

  • search_type (str, optional) – Type of DGGS Zone Search to perform. [Default = “search_box”]

  • construct_cells (boolean, optional) – Flag to select whether, or not, to construct and cache returned DGGS Zones. [Default = True]

  • equalise_cells (boolean, optional) – Flag to equalise the area of the returned DGGS Zones. This ensures that all Surface DGGS Zones for a given resolution are of equal area within a defined level of precision. [Default = True]

  • generate_cell_mesh_flag (boolean, optional) – Flag to generate 3D mesh surfaces/shells for the returned DGGS Zones. These can be used for visualisation purposes [Default = False]

Returns:

task_output – JSON compatible dictionary object is returned containing the details and definition of the selected DGGS Zones.

Return type:

dictionary

ogcapi.views.find_voxels_task(dggs_store, search_box=[], res_min=0, res_max=1, height_min=-1.0, height_max=1.0, ref_location=[], search_radius=0.0, search_type='res', chunk_size=100, get_all_voxels=False, construct_voxels=True, equalise_voxels=True)

Note

Function Details

Celery Task to find Volumetric DGGS Zones in parallel.

Parameters:
  • dggs_store (str, required) – Name of the DGGS database to query for DGGS Zones (i.e. the dggrsID)

  • search_box (array-like, optional) – Search box to use to find the DGGS Zones of interest. [Default=[]]

  • res_min (int, optional) – Minimum DGGS Resolution to search for zones within the Search Box [Default = 0]

  • res_max (int, optional) – Maximum DGGS Resolution to search for zones within the Search Box [Default = 1]

  • height_min (float, optional) – Minimum height (in metres) relative to the Earth Model Surface. - Negative values = metres below the ellipsoidal surface - Positive values = metres above the ellipsoidal surface - [Default = -1.0]

  • height_max (float, optional) – Maximum height (in metres) relative to the Earth Model Surface. - Negative values = metres below the ellipsoidal surface - Positive values = metres above the ellipsoidal surface - [Default = 1.0]

  • ref_location (array-like, optional) – Reference Location as a list/array with [lon,lat,height] of the reference location for a radial search.

  • search_radius (float, optional) – Search Radius in metres from the reference location to perform a radial search for DGGS Zones.

  • search_type (str, optional) – Type of DGGS Zone Search to perform. [Default = “res”]

  • chunk_size (int, optional) – Chunk size to throttle the number of records to process at a time. [Default = 100]

  • construct_cells (boolean, optional) – Flag to select whether, or not, to construct and cache returned DGGS Zones. [Default = True]

  • equalise_cells (boolean, optional) – Flag to equalise the area of the returned DGGS Zones. This ensures that all Surface DGGS Zones for a given resolution are of equal area within a defined level of precision. [Default = True]

Returns:

task_output – JSON compatible dictionary object is returned containing the details and definition of the selected DGGS Zones.

Return type:

dictionary

ogcapi.views.get_registered_cells_task(dggs_store, search_type='res', search_box_label='', search_box=[], search_radius=1.0, ref_location=[], res_min=0, res_max=1, task_key='')

Note

Function Details

Celery Task to find Registered/Cached Surface DGGS Zones in parallel.

Parameters:
  • dggs_store (str, required) – Name of the DGGS database to query for DGGS Zones (i.e. the dggrsID)

  • search_type (str, optional) – Type of DGGS Zone Search to perform. [Default = “res”]

  • search_box_label (str, optional) – Label to reference a search box - if a searchbox/polygon is used to perform the search. [Default = ‘’]

  • search_box (array-like, required) – Search box to use to find the DGGS Zones of interest

  • ref_location (array-like, optional) – Reference Location as a list/array with [lon,lat,height] of the reference location for a radial search.

  • search_radius (float, optional) – Search Radius in metres from the reference location to perform a radial search for DGGS Zones.

  • res_min (int, optional) – Minimum DGGS Resolution to search for zones within the Search Box [Default = 0]

  • res_max (int, optional) – Maximum DGGS Resolution to search for zones within the Search Box [Default = 1]

  • task_key (str, optional) – Unique identifier for the task. [Default = ‘’]

Returns:

  • task_output (dictionary) – JSON compatible dictionary object is returned containing the details and definition of the selected DGGS Zones.

  • :meta private:

ogcapi.views.get_registered_voxels_task(dggs_store, search_type='All_voxels', search_box=[], search_radius=1.0, ref_location=[], res_min=0, res_max=1, height_min=-1, height_max=1, dggs_tool='')

Note

Function Details

Celery Task to find Registered/Cached Volumetric DGGS Zones in parallel.

Parameters:
  • dggs_store (str, required) – Name of the DGGS database to query for DGGS Zones (i.e. the dggrsID)

  • search_type (str, optional) – Type of DGGS Zone Search to perform. [Default = “res”]

  • search_box_label (str, optional) – Label to reference a search box - if a searchbox/polygon is used to perform the search. [Default = ‘’]

  • search_box (array-like, required) – Search box to use to find the DGGS Zones of interest

  • ref_location (array-like, optional) – Reference Location as a list/array with [lon,lat,height] of the reference location for a radial search.

  • search_radius (float, optional) – Search Radius in metres from the reference location to perform a radial search for DGGS Zones.

  • res_min (int, optional) – Minimum DGGS Resolution to search for zones within the Search Box [Default = 0]

  • res_max (int, optional) – Maximum DGGS Resolution to search for zones within the Search Box [Default = 1]

  • height_min (float, optional) – Minimum height (in metres) relative to the Earth Model Surface. - Negative values = metres below the ellipsoidal surface - Positive values = metres above the ellipsoidal surface - [Default = -1.0]

  • height_max (float, optional) – Maximum height (in metres) relative to the Earth Model Surface. - Negative values = metres below the ellipsoidal surface - Positive values = metres above the ellipsoidal surface - [Default = 1.0]

  • dggs_tool (str, optional) – DGGS Tool/Operation to perform. [Default = ‘’]

Returns:

  • task_output (dictionary) – JSON compatible dictionary object is returned containing the details and definition of the selected DGGS Zones.

  • :meta private:

ogcapi.views.find_cooincident_data_task(job_id)

Note

Function Details

Utility task to query data from multiple collections using the mapped DGGS Zones to find spatially coincident data.

Parameters:

job_id (str, required) – The identifier for the OGC API Processing Job to perform this query. Specific job details are retrieved from the TerraNexus database.

Returns:

  • task_output (dictionary) – JSON compatible dictionary object is returned containing the details and definition of the selected DGGS Zones.

  • :meta private:

ogcapi.views.map_data_task(job_id)

Note

Function Details

Utility task to map data from one, or more, collections to a specific TerraNexus DGGS instance.

Parameters:

job_id (str, required) – The identifier for the OGC API Processing Job to perform this query. Specific job details are retrieved from the TerraNexus database.

Returns:

  • task_output (dictionary) – JSON compatible dictionary object is returned containing the details and definition of the selected DGGS Zones.

  • :meta private:

ogcapi.tests module

Note

Module Details

OGCAPI “tests” Module

This module drives the unit tests for the ogcapi endpoints.

Created: 16 September 2022

@author: Dr. Matthew B.J. Purss

class ogcapi.tests.OGCAPI_Authentication_Tests(methodName='runTest')

Bases: TestCase

Note

Class Details Test Harness for OGCAPI Authentication.

This suite of tests validate the machine driven authentication of a user account.

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_tokenLogin()

Note

Function Details

Tests a user can login via a POST request to the …/ogcapi/token endpoint.

test_tokenRefresh()

Note

Function Details

Tests a user can refresh their authentication token via a POST request to the …/ogcapi/token endpoint.

test_tokenVerify_access()

Note

Function Details

Tests a user can verify their authentication access token via a POST request to the …/ogcapi/token endpoint.

test_tokenVerify_refresh()

Note

Function Details

Tests a user can verify their authentication refresh token via a POST request to the …/ogcapi/token endpoint.

class ogcapi.tests.OGCAPI_Processes_Tests(methodName='runTest')

Bases: TestCase

Note

Class Details Test Harness for OGCAPI Processes Endpoints.

ogcapi_processes_asynchronous_execution()

Note

Function Details

Test the {root}/processes/execution OGC API endpoint - using “Asynchronous” execution.

ogcapi_processes_list_deploy()

Note

Function Details

Test the {root}/processes OGC API deployment endpoint - to deploy a new process definition to the TerraNexus OGC API Server

ogcapi_processes_list_get()

Note

Function Details

Test the {root}/processes OGC API endpoint

ogcapi_processes_synchronous_execution()

Note

Function Details

Test the {root}/processes/execution OGC API endpoint - using “Synchronous” execution.

ogcapi_workflows_asynchronous_execution()

Note

Function Details

Test the {root}/processes/execution OGC API endpoint - for workflows using “Asynchronous” execution.

ogcapi_workflows_synchronous_execution()

Note

Function Details Test the {root}/processes/execution OGC API endpoint - for workflows using “Synchronous” execution.

setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.