https://github.com/koopjs/koop-output-geojson
A simple Koop output plugin that filters data from providers and returns in GeoJSON or TopoJSON format
https://github.com/koopjs/koop-output-geojson
geojson koop output plugin topojson
Last synced: about 1 month ago
JSON representation
A simple Koop output plugin that filters data from providers and returns in GeoJSON or TopoJSON format
- Host: GitHub
- URL: https://github.com/koopjs/koop-output-geojson
- Owner: koopjs
- License: mit
- Created: 2019-06-13T17:22:21.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-02-28T22:44:10.000Z (about 2 years ago)
- Last Synced: 2025-02-20T07:19:44.178Z (2 months ago)
- Topics: geojson, koop, output, plugin, topojson
- Language: JavaScript
- Homepage:
- Size: 979 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# koop-output-geojson
[](https://www.npmjs.com/package/koop-output-geojson)
A simple [Koop output plugin](https://koopjs.github.io/docs/usage/output) that filters data from [providers](https://koopjs.github.io/docs/available-plugins/providers) and returns in [GeoJSON](https://en.wikipedia.org/wiki/GeoJSON) or [TopoJSON](https://github.com/topojson/topojson) format.
## Installation
```
$ npm install koop-output-geojson
```## Usage
Register the output plugin before any provider:
```javascript
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](https://github.com/koopjs/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](https://github.com/koopjs/koop-cli#serve) for more details).
## License
MIT