import { Feature } from 'ol'; import { Geometry } from 'ol/geom.js'; import OgcApiClient, { OgcApiClientOptions } from './ogcapiclient.js'; import ServerOgcApiFeatures, { OapifCollection, OapifSchemaResponse } from '../../models/serverogcapifeatures.js'; import ServerOgc from '../../models/serverogc.js'; import { HttpMethod } from '../../models/serverogcapi.js'; import IGirafeContext from '../context/icontext.js'; /** * Class representing an OGC API Features (OAPIF) client that interacts with a server implementing * the OGC API - Features standard. This class provides functionality to fetch, manage, and * manipulate collections and their spatial data from the server. * * Extends `OgcApiClient`: Provides base client functionalities. */ export default class OgcApiFeaturesClient extends OgcApiClient { private collections; constructor(serverConfig: ServerOgc, opt: OgcApiClientOptions, context: IGirafeContext); protected getUrl(): string; protected loadDescribeServer(): Promise; getCollections(): Promise; /** * Retrieves a collection by its ID. If the collection is not already cached, it fetches it from the remote resource, * sanitizes its links, and stores it locally. */ getCollection(collectionId: string): Promise; /** * Retrieves the schema associated with a specified collection. */ getSchema(collectionId: string): Promise; getQueryables(collectionId: string): Promise; /** * Retrieves the related resource for a specified collection and relation type (e.g. `schema`, `self`, `parent`, etc.) */ getCollectionRelation(collectionId: string, relation: string, encodingType?: string): Promise; /** * Retrieves items from a specified collection, optionally applying filters like CRS (Coordinate Reference System), * spatial extent, and limit. */ getItems(collectionId: string, crsCode?: string, extent?: number[], limit?: number): Promise[]>; /** * Retrieves a single item from the specified collection by its ID. */ getItem(collectionId: string, itemId: string, crsCode?: string): Promise>; /** * Creates an item in the specified collection with the specified geometry and CRS code. * Geometries are reprojected if the server does not support the items current CRS. */ createItem(collectionId: string, item: Feature, crsCode: string): Promise; /** * Updates an existing item in the specified collection. */ updateItem(collectionId: string, itemId: string, item: Feature, crsCode: string): Promise; /** * Deletes an item from a specific collection. */ deleteItem(collectionId: string, itemId: string): Promise; /** * Retrieves the CRS (Coordinate Reference System) identifier for a specific collection based on the provided CRS code. * This is necessary because CRS identifiers can vary slightly (e.g. http vs https) between servers, * and it's best to use the identifiers provided by the server. */ private getCrsIdentifier; private getEpsgCodeFromCrsIdentifier; /** * Checks if the provided extent's coordinate reference system (CRS) is supported by a given collection * and reprojects the extent if necessary. */ private reprojectExtentToSupportedCrs; /** * Retrieves the storage coordinate reference system (CRS) for a specified collection. * The storageCrs information is only available if the server supports part 2 of the OGC API Features specification. */ private getStorageCrs; /** * When performing a write operation, reproject the feature geometry to match the storage coordinate reference system * (CRS) of the server. If no storage CRS is specified, geometries are reprojected to WGS84 lon / lat, * which is the default CRS for OAPIF and GeoJson. */ private reprojectItemToStorageCrs; /** * Expands the method from OgcApiClient by customizing headers to support GeoJson content and optional CRS identifier. */ protected getFetchOptions(method?: HttpMethod, crsIdentifier?: string): RequestInit; }