Skip to content

Commit

Permalink
fixed bug for Pipes.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jin IGARASHI committed Aug 9, 2020
1 parent cdf54db commit adbaf89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@watergis/geojson2inp",
"version": "0.1.4",
"version": "0.1.5",
"description": "This module converts GeoJSON to EPANET INP file",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
9 changes: 8 additions & 1 deletion src/layer/Pipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,14 @@ export default class Pipes extends LayerBase {
geojson.features.forEach((f: GeoJSON.Feature) => {
const pipe_id: string = getProperty(f.properties, 'id');
const pipe_size: number = getProperty(f.properties, 'diameter');
const coordinates: number[][] = getProperty(f.geometry, 'coordinates')[0];
let coordinates: number[][];
switch (f.geometry.type){
case 'MultiPoint':
coordinates = getProperty(f.geometry, 'coordinates');
break;
default:
coordinates = getProperty(f.geometry, 'coordinates')[0];
}
coordinates.forEach(c1=>{
const x1 : number= roundTo(c1[0], 6);
const y1 : number= roundTo(c1[1], 6);
Expand Down

0 comments on commit adbaf89

Please sign in to comment.