1.0.0 • Published 6 years ago

@lobsterlabs/koop-provider-geojson v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 years ago

Build Status Greenkeeper badge

Koop geojson Provider

This is a geojson that demonstrates how to build a Koop Provider. Full documentation is provided here.

/geojson/{url|pipe|path}/FeatureServer/0/query

where the URL changes / to | for including in the url. e.g.

example.com%7Cshares%7C6de6fe4ccdea85b8.geojson

To try this out, here are few example services:

If you want to write your own provider, simply fork this repository or copy the contents.

Files

FileDescription
index.jsMandatoryConfigures provider for usage by Koop
model.jsMandatoryTranslates remote API to GeoJSON
routes.jsOptionalSpecifies additional routes to be handled by this provider
controller.jsOptionalHandles additional routes specified in routes.js
server.jsOptionalReference implementation for the provider
test/model-test.jsOptionaltests the getData function on the model
test/fixtures/input.jsonOptionala geojson of the raw input from the 3rd party API
config/default.jsonOptionalused for advanced configuration, usually API keys.

Test it out

Run server:

  • npm install
  • DEPLOY=dev node server.js

Example API Query:

  • curl localhost:8080/geojson/FeatureServer/0/query?returnCountOnly=true

Tests:

  • npm test

With Docker

  • docker build -t koop-provider-geojson .
  • docker run -it -p 8080:8080 koop-provider-geojson

Publish to npm

  • run npm init and update the fields
    • Choose a name like koop-provider-foo
  • run npm publish