Skip to content

A simple Koop output plugin that filters data from providers and returns in GeoJSON or TopoJSON format

License

Notifications You must be signed in to change notification settings

koopjs/koop-output-geojson

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koop-output-geojson

npm

A simple Koop output plugin that filters data from providers and returns in GeoJSON or TopoJSON format.

Installation

$ npm install koop-output-geojson

Usage

Register the output plugin before any provider:

const Koop = require("koop");

// an example data provider
const provider = require("@koopjs/provider-file-geojson");
const output = require("koop-output-geojson");

const koop = new Koop();

koop.register(output);
koop.register(provider);

koop.server.listen(3000, () => {
  console.log(`Server listening at http://localhost:3000`);
});

This output provides two routes:

"GeoJSON" output routes for the "dev-provider" provider  Methods
-------------------------------------------------------  ---------
/dev-provider/geojson                                    GET, POST
/dev-provider/topojson                                   GET, POST

Both routes support on-the-fly filtering with winnow using SQL query in the where query parameter. For example,

GET /dev-provider/geojson?where='count'>0

or add the query in the body of the POST request.

Development

Dev Server

Run the dev server using the command

$ npm start

The server will be running at http://localhost:8080 and serving the test data file test/data.geojson by default (see Koop CLI docs for more details).

License

MIT

About

A simple Koop output plugin that filters data from providers and returns in GeoJSON or TopoJSON format

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published