Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/watergis/geojson2inp
This module converts GeoJSON to EPANET INP file
https://github.com/watergis/geojson2inp
epanet epanet-inp geojson
Last synced: 23 days ago
JSON representation
This module converts GeoJSON to EPANET INP file
- Host: GitHub
- URL: https://github.com/watergis/geojson2inp
- Owner: watergis
- License: mit
- Created: 2020-07-23T01:54:38.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-06-22T14:42:56.000Z (over 1 year ago)
- Last Synced: 2024-10-30T05:43:08.572Z (about 2 months ago)
- Topics: epanet, epanet-inp, geojson
- Language: TypeScript
- Size: 160 KB
- Stars: 3
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# geojson2inp
![](https://github.com/watergis/geojson2inp/workflows/Node.js%20Package/badge.svg)
![GitHub](https://img.shields.io/github/license/watergis/geojson2inp)This module converts GeoJSON to EPANET INP file
## Installation
```
npm install @watergis/geojson2inp
```## Usage
```js
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](./test/data) direcotry.
You can produce your own GeoJSON by using [watergis/postgis2geojson](https://github.com/watergis/postgis2geojson) package.
## Build
```
npm run build
```## Test
```
npm test
```