Commit 60d70354 authored by Michael Auer's avatar Michael Auer
Browse files

improved and updated documentation

parent 4078f65d
......@@ -5,6 +5,7 @@
> Input: Accepts GeoJSON or PostgreSQL/PostGIS as input source.
> Output: Creates a GeoJSON File or new result table in your PostgreSQL/PostGIS database.
The package includes a library with a single class to run.
Additionally it includes `oshome2x-cli`, a command-line tool with a configuration wizard to create and run a query-configuration-JSON.
......@@ -15,30 +16,47 @@ This software is developed by [HeiGIT](https://heigit.org):
<img src="https://heigit.org/wp-content/uploads/2018/01/HeiGIT_Logo_cut-505x100@2x.png" alt="HeiGIT Logo" height="80px" width="404px">
## Install
## Usage
There are two ways how you can use ohsome2x.
### 1. Without installation using the npm package runner `npx`
> Info: The `npx` command comes with the installation of `npm`.
For use as library in Node.js:
```sh
$ npm install @giscience/ohsome2x
```
To run the command-line wizard:
```sh
$ npx ohsome2x-cli
Syntax info:
$ npx @giscience/ohsome2x
-------------------------
USAGE:
with 'npx'
npx @giscience/ohsome2x createconfig [(-o|--out) path]
npx @giscience/ohsome2x run (-c|--conf) fullConfig.json
as local command
node ohsome2x-cli.js createconfig [(-o|--out) path]
node ohsome2x-cli.js run (-c|--conf) fullConfig.json
-------------------------
```
### 2. With installation as library to use it in your Node.js script
## Usage
There are two ways how you can use ohsome2x.
1. For use as library in Node.js install the package:
```sh
$ npm install @giscience/ohsome2x
```
2. You find the built library in the `/dist` folder after executing:
1. Use it as library in another Node.js project. You find the built library in the `/dist` folder after executing `npm run build`
2. Use the interactive command line interface.
```
$ npm run build
```
Run:
```sh
$ npx ohsome2x-cli
OR
$ node ./ohsome2x-cli/ohsome2x-cli.js
```
3. Write your own JavaScript or TypeScript file:
```
See Examples and API section to learn how to do it. Enjoy!
```
## Example
......@@ -63,14 +81,15 @@ There are two ways how you can use ohsome2x.
]]}}]}
```
##### Step 2. Specify your query as JSON (you can use the commandline wizard to create this): myquery.json
##### Step 2. Specify your query as JSON-file (you can use the commandline wizard to create this): myquery.json
> Info: for the filter Syntax see: https://docs.ohsome.org/ohsome-api/stable/filter.html
```json
{
"ohsomeQuery": {
"queryType": "elements/count/groupBy/boundary",
"keys": "building",
"values": "",
"types": "polygon",
"filter": "building=* and building!=no and geometry:polygon",
"time": "2008/2020/P1Y"
},
"source": {
......@@ -92,7 +111,7 @@ There are two ways how you can use ohsome2x.
##### Step 3. Run the Query
```bash
$ npx ohsome2x-cli run --conf myquery.json
$ npx @giscience/ohsome2x run --conf myquery.json
```
......@@ -119,7 +138,7 @@ ohsome2x.run().catch(console.log);
TypeScript:
```typescript
import Ohsome2X = require('@giscience/ohsome2x');
import {Ohsome2XConfig} from 'ohsome2x/dist/config_types_interfaces';
import {Ohsome2XConfig} from '@giscience/ohsome2x/dist/config_types_interfaces';
// you can create this config using the command-line wizard, run: npx ohsome2x-cli
const config: Ohsome2XConfig = {
......
......@@ -13,6 +13,10 @@ async function run() {
if (argv._[0] == null) {
console.log('-------------------------');
console.log('USAGE:');
console.log(`with 'npx'`);
console.log('npx @giscience/ohsome2x createconfig [(-o|--out) path]');
console.log('npx @giscience/ohsome2x run (-c|--conf) fullConfig.json');
console.log('as local command');
console.log('node ohsome2x-cli.js createconfig [(-o|--out) path]');
console.log('node ohsome2x-cli.js run (-c|--conf) fullConfig.json');
console.log('-------------------------');
......@@ -317,7 +321,7 @@ let configureOhsomeQuery = async () => {
},
{
name: 'filter',
message: 'Specify an ohsome-api filter text (e.g. building=* and building!=no and geometry:polygon):\n More info on syntax: https://docs.ohsome.org/ohsome-api/ \n>'
message: 'Specify an ohsome-api filter text (e.g. building=* and building!=no and geometry:polygon):\n More info on syntax: https://docs.ohsome.org/ohsome-api/stable/filter.html \n>'
},
{
name: 'time',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment