I've created a hydro model in HEC-RAS (ver 5.0.3) and have a separate flow profiles for every day of the year, using the 53-year median flow rate for that day, and under multiple structural scenarios proposed for the removal/modification of a dam.

I am creating several maps and animations from the results, and need the daily results as both Inundation Boundary shapefiles and Depth rasters. While HEC-RAS is able to export the results, every single exported file must be individually added via the Manage Results Maps menu in RAS Mapper. I started this process manually, but it's 4 clicks plus scrolling per map.

enter image description here

Even getting just one of the structural scenarios in both shapefile and raster outputs will take ages. As I'll eventually want to expand my results to include historic high and low flow profiles as well, the prospect of that much clicking is galling.

There has to be some way of doing this as a batch process. Hopefully it's one of the changes coming in 5.1, but until then, how can I get several thousand maps exported from HEC-RAS without having to add every map manually?

1 Answer 1


The best solution I have been able to find comes from a blog, The RAS Solution. It doesn't completely solve the problem, but we'll follow their steps until it becomes necessary to diverge.

  1. Add at least one map of each type using the Manage Results Maps window.

enter image description here

  1. Save and exit the program. With HEC-RAS closed, find and open the your_file.rasmap document. You may wish to create a backup of this file first.

  2. In the rasmap file, look for the Results section. You should find something which resembles the following:

    <Layer Name="depth" Type="RASResultsMap" Checked="True">
        <Pen A="255" R="0" G="255" B="255" Width="2" />
        <Brush A="32" R="32" G="178" B="170" />
        <SurfaceFill Alpha="255" Colors="-16711681,-16777077" Values="0,15" Stretched="True" />
        <Contour On="False" Interval="5" Color="-16777216" />
        <LabelFeatures Checked="True" rows="1" cols="1" r0c0="Map Value" Position="5" Color="-16777216" />
        <MapParameters MapType="depth" LayerName="Depth" OutputMode="Stored Current Terrain" StoredFilename=".\Inundation Mapping\Depth (Jan 1).vrt" Terrain="Terrain" ContourPolygonValue="0" ProfileIndex="0" ProfileName="Jan 1" ArrivalDepth="0" ArrivalStartMode="0" Hours="True" />

Now this is where the provided solution at the above-referenced blog post falls short. It is suggested that you simply copy and paste this block of code and replace the appropriate ProfileName and StoredFilename under MapParameters.

In my experience, however, doing so yields the following results:

lots of Jan 1s

But I don't need 365 copies of Jan 1! And also, the process of finding and replacing all the file/profile names isn't that much of a time-saver of the endless clicking of before.

Turns out, when RAS Mapper loads your_file.rasmap, it's really reading the ProfileIndex="x" parameter, then filling the other parameters based on the value of x. In the above situation, when I re-opened my .rasmap file all of my edits to ProfileName and StoredFilename had been replaced.

  1. Copy the block of code from before and duplicate it until you have n of them, and simply update ProfileIndex to incrementally increase up to n-1. Depending on the program you're using (Vim, Notepad++, &c) and your proficiency, you can do this right in your editor.

If that's above your head (as it was for me when I first encountered this problem), it's also possible to do via a spreadsheet program:

  • Column A: XML code from Layer thru ProfileIndex="
  • Column B: An incremental field beginning at 0, increasing by 1.
  • Column C: XML code following the ProfileIndex closequote thru to /Layer.
  • Column D: =CONCATENATE(A$1,B1,C$1)

excel concatenation

incremental profile index field

Copy column D into your .rasmap file where the original layer information was. It will be an ugly block of code, but the program will still read it just fine.

  1. However you got your .rasmap file updated, save and close. Open HEC-RAS and get to the Manage Results Maps again. You should now see a full list of your maps!

  2. Select all, click Compute/Update Stored Maps. Once finished, open the destination folder, where you will find all your files. Hooray for time saved!

  • Great answer @JoshC! I think one can easily program this in R or Python
    – Tung
    Jun 26, 2019 at 19:29
  • 1
    Thanks! I kind of forgot about this self-answer. It predated my foray into Python, but I can certainly see the potential for a more efficient solution.
    – jcarlson
    Jun 27, 2019 at 14:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.