diff --git a/Epa2GIS.py b/Epa2GIS.py index 6e672d8..9a2695e 100644 --- a/Epa2GIS.py +++ b/Epa2GIS.py @@ -239,20 +239,26 @@ def epa2gis(inpname, epsg_crs): ndIndexNew = ndCoordsID.index(ndID[i]) featJ = QgsFeature() point = QgsPointXY(float(x[ndIndexNew]), float(y[ndIndexNew])) - featJ.initAttributes(3 + len(ndBaseTmp[0]) * 2) featJ.setGeometry(QgsGeometry.fromPointXY(point)) - featJ.setAttribute(0, ndID[i]) - featJ.setAttribute(1, ndEle[i]) - w = 2 - for j in range(0, len(ndBaseTmp[0])): - featJ.setAttribute(w, ndBaseTmp[i][j]) - featJ.setAttribute(w + 1, ndPatTmp[i][j]) - w = w + 2 - featJ.setAttribute(w, ndDes[i]) - prJunction.addFeatures([featJ]) - except: + # Remove support for multiple basedemands [temporary] + if ndBaseTmp: + featJ.initAttributes(3 + len(ndBaseTmp[0]) * 2) + featJ.setAttribute(0, ndID[i]) + featJ.setAttribute(1, ndEle[i]) + w = 2 + for j in range(0, len(ndBaseTmp[0])): + featJ.setAttribute(w, ndBaseTmp[i][j]) + featJ.setAttribute(w + 1, ndPatTmp[i][j]) + w = w + 2 + featJ.setAttribute(w, ndDes[i]) + else: + featJ.setAttributes([ndID[i], ndEle[i], 0, '', ndDes[i]]) + + prJunction.addFeatures([featJ]) + except Exception as e: pass + if i < nlinkCount: if len(stat) == i: ch = 1 diff --git a/metadata.txt b/metadata.txt index b9cf582..2d773d4 100644 --- a/metadata.txt +++ b/metadata.txt @@ -11,7 +11,7 @@ name=ImportEpanetInpFiles qgisMinimumVersion=2.99 qgisMaximumVersion=3.99 description=IMPORT/EXPORT EPANET INP Files -version=1.6.3 +version=1.6.4 author=Marios S. Kyriakou, KIOS Research and Innovation Center of Excellence (KIOS CoE) email=mkiria01@ucy.ac.cy about=This tool can be used to IMPORT EPANET INP File to shapefiles and adds them in the QGIS canvas. Also, the shapefiles stored into the _shapefiles_ folder. Can be used to EXPORT EPANET INP File. @@ -21,7 +21,9 @@ about=This tool can be used to IMPORT EPANET INP File to shapefiles and adds the # Optional items: # Uncomment the following line and add your changelog: -changelog=2021-10-17 ImportEpanetInpFiles 1.6.3: +changelog=2022-10-22 ImportEpanetInpFiles 1.6.4: + Fix issue with junctions + 2021-10-17 ImportEpanetInpFiles 1.6.3: Fixed issue with description field 2020-11-06 ImportEpanetInpFiles 1.6.2: Fixed issue with export vertices