resyfer / test-api-features-client

Test Repo for OGC Api Features Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

test-api-features-client

Test Repo for Api Features Client

Start API

Ensure docker is installed.

$ sudo docker pull geopython/pygeoapi
$ sudo docker run -p 5000:80 geopython/pygeoapi # Alternative: pnpm docker

Now the API is running on http://localhost:5000

Installation

Have NodeJS & NPM installed. Clone the repo.

$ cd test-api-features-client
$ npm i -g pnpm
$ pnpm install

Usage

import ogc from "<path-to-src-folder>";

Accessing Routes

(async() => {
  await ogc.get() // Route: /, Method: GET
  await ogc.conformance().get(); // Route: /conformance, Method: GET
  await ogc.collections().get(); // Route: /collections, Method: GET
  await ogc.collection("collection_id").get(); // Route: /collections/collection_id, Method: GET
  await ogc.collection("collection_id").items().get(); // Route: /collections/collection_id/items, Method: GET
  await ogc.collection("collection_id").item("feature_id").get(); // Route : /collections/collection_id/items/feature_id, Method: GET
})();

in accordance to the OGC Features API v1.0.1

Usage

import ogc from "../src";

(async() => {

  const res = await ogc.collections().get();

  if(res.status === 200) {
    console.log(res.data.links[0].href);
  } else {
    console.log(res.data.code);
  }

})()

Testing

Make sure API is running and then

$ pnpm test

Building

$ pnpm build

About

Test Repo for OGC Api Features Client

License:GNU General Public License v3.0


Languages

Language:TypeScript 100.0%