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

convenience library to query ohsome-api using nodejs

  • 1.2.4
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-81.82%
Maintainers
2
Weekly downloads
 
Created
Source

ohsome2X

Query OSM History Data (count, length, area) about specific OSM Features or OSM User activity (user-count) for your areas of interest.

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.

This library/tool makes use of the Ohsome-API (https://api.ohsome.org) as data backend and many other great open-source libraries.

This software is developed by HeiGIT:

HeiGIT Logo

Install

For use as library in Node.js:

$ npm install @giscience/ohsome2x

To run the command-line wizard:

$ npx ohsome2x-cli

Usage

There are two ways how you can use ohsome2x.

  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.

    Run:

    $ npx ohsome2x-cli
    OR 
    $ node ./ohsome2x-cli/ohsome2x-cli.js
    

Example

Query the number of buildings in a bbox around Heidelberg in a yearly resolution from 2008 to 2020

Step 1. You need some input (one or many polygons): heidelberg.geojson
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": {"id": "Heidelberg"},
      "geometry": {
        "type": "Polygon",
        "coordinates": [
          [ [8.625984191894531, 49.38527827629032],
            [8.735504150390625, 49.38527827629032],
            [8.735504150390625, 49.433975502014675],
            [8.625984191894531, 49.433975502014675],
            [8.625984191894531, 49.38527827629032]
          ]]}}]}
Step 2. Specify your query as JSON (you can use the commandline wizard to create this): myquery.json
{
  "ohsomeQuery": {
    "queryType": "elements/count/groupBy/boundary",
    "keys": "building",
    "values": "",
    "types": "polygon",
    "time": "2008/2020/P1Y"
  },
  "source": {
    "geometryId": "id",
    "name": "heidelberg.geojson",
    "store": { "path": "heidelberg.geojson", "type": "geojson" }
  },
  "target": {
    "horizontalTimestampColumns": false,
    "createGeometry": true,
    "transformToWebmercator": false,
    "storeZeroValues": true,
    "computeValuePerArea": true,
    "name": "heidelberg_buildings_count.geojson",
    "store": { "path": "heidelberg_buildings_count.geojson", "type": "geojson" }
  }
}
Step 3. Run the Query
$ npx ohsome2x-cli run --conf myquery.json

API

Node:

const Ohsome2X = require('@giscience/ohsome2x');

// you can create this config using the command-line wizard, run: npx ohsome2x-cli
const config = {
                ohsomeQuery: {...},
                source: {...},
                target: {...}
}                               

const ohsome2x = new Ohsome2X(config);

// This will return a Promise
ohsome2x.run().catch(console.log);

TypeScript:

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

// you can create this config using the command-line wizard, run: npx ohsome2x-cli
const config: Ohsome2XConfig = {
                ohsomeQuery: {...},
                source: {...},
                target: {...}
}                               

const ohsome2x = new Ohsome2X(config);

// This will return a Promise
ohsome2x.run().catch(console.log);
  • OhsomeHeX - The OSM History Explorer: Uses this library as backend
  • OhsomeAPI - WebAPI to query OSM History Data
  • OSHDB - The OpenStreetMap History Database: Query OSM History Data with Java
  • ohsome.org - Get Information about all these technologies and more
  • heigit.org - The Heidelberg Institute for Geoinformation Technology: The non-profit company behind all those useful tools.

Keywords

FAQs

Package last updated on 11 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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