0.1.5 • Published 4 years ago

@watergis/geojson2inp v0.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

geojson2inp

npm.io GitHub

This module converts GeoJSON to EPANET INP file

Installation

npm install @watergis/geojson2inp

Usage

const {geojson2inp} = require('@watergis/geojson2inp');

const config = {
      title: 'test', //title for the project name which is appeared in INP
      geojson: {
        junctions: __dirname + '/data/junctions.geojson',  //required
        pipes: __dirname + '/data/pipes.geojson',  //required
        pumps: __dirname + '/data/pumps.geojson',  //optional
        reservoirs: __dirname + '/data/reservoirs.geojson',  //optional
        tanks: __dirname + '/data/tanks.geojson',  //optional
        valves: __dirname + '/data/valves.geojson'  //optional
      },
      output: __dirname + '/data.inp'  //output INP file path
    }
  
const js2inp = new geojson2inp(config.geojson, config.output, config.title);
const file = await js2inp.generate() //return exported inp file path

Both junctions and pipes are required. Others are optional, however you can't also analyze it in EPANET without reservoirs and tanks.

About interfaces of GeoJSON, please see the sample data and tests/data direcotry.

You can produce your own GeoJSON by using watergis/postgis2geojson package.

Build

npm run build

Test

npm test
0.1.5

4 years ago

0.1.2

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago