Hello everyone,
I tried to make the RAS1D Levees command update the levee points' elevation, at the same level of the DTM, but unsuccesfully.
I post the hecobjects.py part I modified, it is only this class.
class LeveeAlignment(HecRasObject):
def __init__(self):
super(LeveeAlignment, self).__init__()
self.order = 10
self.geom_type = 'LINESTRING'
self.attrs = [('"LeveeID"', 'serial primary key'),('"DtmID"', 'integer')]
def pg_levee_positions(self):
qry = '''
INSERT INTO "{0}"."LeveePoints"(geom, "LeveeID", "XsecID", "Fraction")
SELECT
ST_Intersection(lev.geom, xs.geom) AS geom,
lev."LeveeID",
xs."XsecID",
ST_LineLocatePoint(xs.geom, ST_Intersection(lev.geom, xs.geom)) AS "Fraction"
FROM
"{0}"."LeveeAlignment" AS lev,
"{0}"."XSCutLines" AS xs
WHERE
ST_Intersects(xs.geom, lev.geom);
'''
qry = qry.format(self.schema)
#return qry
"""Probe a DTM to find cross-section vertical shape"""
# Prepare DTMs
prepare_DTMs(rgis)
if not rgis.dtms:
rgis.addInfo('<br>No DTM for elevation sampling. Probing aborted!')
return
#surface_obj = heco.LeveePoints()
#parent_obj = heco.LeveeAlignment()
surface_obj = LeveePoints()
parent_obj = LeveeAlignment()
update_DtmID(rgis, parent_obj)
try:
chunk = rgis.dtm_chunksize
except:
chunk = 0
# insert points along each xsection
#rgis.rdb.process_hecobject(heco.LeveePoints, 'pg_create_table')
#rgis.rdb.process_hecobject(heco.XSCutLines, 'pg_surface_points')
# probe a DTM at each point
QApplication.setOverrideCursor(Qt.WaitCursor)
try:
probe_DTMs(rgis, surface_obj, parent_obj, chunksize=chunk)
rgis.addInfo('Done')
finally:
QApplication.restoreOverrideCursor()