Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@giscience/ohsome2x

Package Overview
Dependencies
Maintainers
2
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@giscience/ohsome2x - npm Package Compare versions

Comparing version 1.2.4 to 2.0.0

LICENSE

2

dist/conf/default.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const defaultConfig = {
OHSOME_API_URL: 'https://api.ohsome.org/v0.9'
OHSOME_API_URL: 'https://api.ohsome.org/v1'
};
exports.default = defaultConfig;

@@ -50,9 +50,6 @@ import { FeatureCollection } from '@turf/helpers';

}
export declare type OhsomeQueryConfigTypes = 'node' | 'way' | 'relation' | 'node,way' | 'node,relation' | 'way,relation' | 'node,way,relation' | 'point' | 'line' | 'polygon' | 'point,line' | 'point,polygon' | 'line,polygon' | 'point,line,polygon' | '';
export declare type OhsomeQueryConfigFormat = 'json' | 'csv' | undefined;
export interface OhsomeQueryConfig {
queryType: string;
keys?: string;
values?: string;
types: OhsomeQueryConfigTypes;
filter?: string;
time: string;

@@ -59,0 +56,0 @@ bpolys?: FeatureCollection | string;

@@ -98,3 +98,3 @@ "use strict";

this.isContributionView = this.checkIsContributionView(ohsomeResults.data);
console.log('Start conversion ohsomeJSON to GeoJSON');
console.log('Start conversion ohsome-result to GeoJSON');
console.time('convert');

@@ -130,2 +130,3 @@ if (shouldCreateGeometry) {

await this.targetFeatureType.writeFeatures(targetFeatureCollection);
console.log('-----------------------------------------' + Date.now() + '-----------------------------------------');
}

@@ -243,4 +244,3 @@ }

async getOhsomeResults(ohsomeQuery) {
const keys = (ohsomeQuery.keys != null && ohsomeQuery.keys.trim() != '') ? ohsomeQuery.keys.trim() : undefined;
const values = (ohsomeQuery.values != null && ohsomeQuery.values.trim() != '') ? ohsomeQuery.values.trim() : undefined;
const filter = (ohsomeQuery.filter != null && ohsomeQuery.filter.trim() != '') ? ohsomeQuery.filter.trim() : undefined;
const format = (ohsomeQuery.format != null && ohsomeQuery.format.trim() != '') ? ohsomeQuery.format.trim() : undefined;

@@ -254,6 +254,4 @@ try {

bpolys: bpolyString,
keys: keys,
values: values,
filter: filter,
time: ohsomeQuery.time,
types: ohsomeQuery.types,
showMetadata: true,

@@ -260,0 +258,0 @@ format: format

@@ -15,3 +15,2 @@ import { PostgisStore, SourcePostgisFeatureTypeConfig, TargetPostgisFeatureTypeConfig } from './config_types_interfaces';

constructor(config: SourcePostgisFeatureTypeConfig | TargetPostgisFeatureTypeConfig);
runCheckTableExists(): Promise<void>;
checkTableExists(): Promise<any>;

@@ -18,0 +17,0 @@ closeConnections(): Promise<void>;

@@ -26,7 +26,4 @@ "use strict";

this.db = new pg_async_1.default(this.store);
this.runCheckTableExists();
this.checkTableExists();
}
async runCheckTableExists() {
this.tableExists = await this.checkTableExists();
}
async checkTableExists() {

@@ -45,2 +42,3 @@ const sql = `SELECT EXISTS (

console.log(`Checked if TABLE ${this.schemaName}.${this.tableName} exists: ${exists}`);
this.tableExists = exists;
return exists;

@@ -47,0 +45,0 @@ }

@@ -16,2 +16,6 @@ #!/usr/bin/env node

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]');

@@ -311,31 +315,13 @@ console.log('node ohsome2x-cli.js run (-c|--conf) fullConfig.json');

choices: [
{name: 'elements/count/groupBy/boundary', value: 'elements/count'},
{name: 'elements/length/groupBy/boundary', value: 'elements/length'},
{name: 'elements/area/groupBy/boundary', value: 'elements/area'},
{name: 'elements/perimeter/groupBy/boundary', value: 'elements/perimeter'},
{name: 'users/count/groupBy/boundary', value: 'users/count'}
{name: 'elements/count/groupBy/boundary'},
{name: 'elements/length/groupBy/boundary'},
{name: 'elements/area/groupBy/boundary'},
{name: 'elements/perimeter/groupBy/boundary'},
{name: 'users/count/groupBy/boundary'}
],
deafult: 'elements/count'
default: 'elements/count/groupBy/boundary'
},
{name: 'keys'},
{name: 'values'},
{
type: 'list',
name: 'types',
choices: [
'node',
'way',
'relation',
'way,relation',
'node,way',
'node,relation',
'node,way,relation',
'point',
'line',
'polygon',
'point,line',
'point,polygon',
'line,polygon',
'point,line,polygon'
]
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/stable/filter.html \n>'
},

@@ -342,0 +328,0 @@ {

{
"name": "@giscience/ohsome2x",
"version": "1.2.4",
"version": "2.0.0",
"description": "convenience library to query ohsome-api using nodejs",

@@ -5,0 +5,0 @@ "main": "dist/Ohsome2X.js",

@@ -8,7 +8,8 @@ # ohsome2X

> 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.
Additionally it includes `ohsome2x-cli`, a command-line tool with a configuration wizard to create and run a query-configuration-JSON.
This library/tool makes use of the Ohsome-API (https://api.ohsome.org) as data backend and many other great open-source libraries.
This library/tool makes use of the ohsome API (https://api.ohsome.org) as data backend and many other great open-source libraries.

@@ -19,26 +20,43 @@ This software is developed by [HeiGIT](https://heigit.org):

## Install
## Usage
There are two ways how you can use ohsome2x.
For use as library in Node.js:
```sh
$ npm install @giscience/ohsome2x
```
### 1. Without installation using the npm package runner `npx`
> Info: The `npx` command comes with the installation of `npm`.
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:
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.
```sh
$ npm install @giscience/ohsome2x
```
Run:
```sh
$ npx ohsome2x-cli
OR
$ node ./ohsome2x-cli/ohsome2x-cli.js
```
2. You find the built library in the `/dist` folder after executing:
```
$ npm run build
```
3. Write your own JavaScript or TypeScript file:
```
See Examples and API section to learn how to do it. Enjoy!
```

@@ -68,3 +86,6 @@ ## Example

##### 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

@@ -74,5 +95,3 @@ {

"queryType": "elements/count/groupBy/boundary",
"keys": "building",
"values": "",
"types": "polygon",
"filter": "building=* and building!=no and geometry:polygon",
"time": "2008/2020/P1Y"

@@ -99,3 +118,3 @@ },

```bash
$ npx ohsome2x-cli run --conf myquery.json
$ npx @giscience/ohsome2x run --conf myquery.json
```

@@ -127,3 +146,3 @@

import Ohsome2X = require('@giscience/ohsome2x');
import {Ohsome2XConfig} from 'ohsome2x/dist/config_types_interfaces';
import {Ohsome2XConfig} from '@giscience/ohsome2x/dist/config_types_interfaces';

@@ -146,5 +165,5 @@ // you can create this config using the command-line wizard, run: npx ohsome2x-cli

- [OhsomeHeX](https://ohsome.org/apps/osm-history-explorer) - The OSM History Explorer: Uses this library as backend
- [OhsomeAPI](https://api.ohsome.org) - WebAPI to query OSM History Data
- [ohsome API](https://api.ohsome.org) - WebAPI to query OSM History Data
- [OSHDB](https://github.com/GIScience/oshdb) - The OpenStreetMap History Database: Query OSM History Data with Java
- [ohsome.org](https://ohsome.org) - Get Information about all these technologies and more
- [ohsome.org](https://ohsome.org) - Get information about all these technologies and more
- [heigit.org](https://heigit.org) - The Heidelberg Institute for Geoinformation Technology: The non-profit company behind all those useful tools.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc