@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
59 lines (57 loc) • 2.71 kB
TypeScript
/**
* Provides utility functions for the [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/).
*
* @since 5.0
* @see [OGCFeatureLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/OGCFeatureLayer/)
*/
import type { CollectionsPage, LandingPage, QueryOptions } from "./types.js";
/**
* Returns an array of feature collections available on the server.
*
* @param landingPage - An OGC API-Feature server landing page.
* @param options - Additional options.
* @returns A promise that resolves to the server's collections page.
* @since 5.0
* @see [getServerLandingPage()](https://developers.arcgis.com/javascript/latest/references/core/layers/ogc/ogcFeatureUtils/#getServerLandingPage)
* @example
* // Print the ids and titles of all collections published to the ogc-api features server.
* const url = "https://demo.ldproxy.net/daraa";
*
* const ogcFeatureUtils = await $arcgis.import("@arcgis/core/layers/ogc/ogcFeatureUtils.js");
* const landingPage = await ogcFeatureUtils.getServerLandingPage(url);
* const collectionsPage = await ogcFeatureUtils.getServerCollectionsPage(landingPage);
* for (const collection of collectionsPage.collections) {
* const { id, title } = collection;
* console.log(`
* Collection id: ${id}
* Collection title: ${title ?? "not specified"}
* `);
* }
*/
export function getServerCollectionsPage(landingPage: LandingPage, options?: QueryOptions): Promise<CollectionsPage>;
/**
* Returns the landing page for an OGC API-Features server.
*
* @param url - The URL to an OGC API-Features server.
* @param options - Additional options.
* @returns A promise that resolves to the server's landing page.
*
* > [!WARNING]
* >
* > The url that returns the json representation of the landing page may or may not include query parameters, for
* > example, "f=json". This function does not append any query parameters to the provided url. If the server requires
* > specific query parameters to return the landing page, please ensure they are included in the provided url.
* @since 5.0
* @example
* // Print the title and description of the server landing page to console.
* const url = "https://demo.ldproxy.net/daraa";
*
* const ogcFeatureUtils = await $arcgis.import("@arcgis/core/layers/ogc/ogcFeatureUtils.js");
* const landingPage = await ogcFeatureUtils.getServerLandingPage(url);
* const { description, title } = landingPage;
* console.log(`
* Title: ${title ?? "not specified"}
* Description: ${description ?? "not specified"}
* `);
*/
export function getServerLandingPage(url: string, options?: QueryOptions): Promise<LandingPage>;