Riverscapes/RaveAddIn

Some issues with CHaMP Topo Business Logic

Closed this issue · 9 comments

In commit e6bd92e78f699b7876bae411e70505a726652a7e I tried to get a draft business logic working for the CHaMP Topo Toolbar Riverscapes Projects.

The layer files I used (or attempted) to are here: topo layer files

The good news is much of this worked. I'm sure I'm doing something subtle and simple for the problems I am having, but some might be bugs. All the ones for which I am having issues are shown here with numbers:
image

The Problems

1. Hillshade

The hillshade does not add to map. https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L110

Also, if I override any of the xpathlabel="name" with something custom (e.g. label="Digital Elevation Model), it breaks the business logic. It works for other ones though outside of this parent node.

2. Water Surface TIN

The Water Surface TIN shows up in tree, but does not add to map.
https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L103

3. No TIN

I can't add the TIN to the business logic without it breaking. I tried:
<Node xpathlabel="Name" xpath="Realizations/Topography/TIN[@id='TIN']" type="TIN" symbology="" /> among other attempts.

https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L102

4. No Thalweg

Although I can get Thalwegs to show up in tree, I cannot get them to add to map:
https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L67 (they do create an empty Hydraulics parent layer group).

5. No Water Surface DEM

None of the layers in Hydraulics node are working. https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L63-L69

6. No Water Depth

None of the layers in Hydraulics node are working. https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L63-L69

7. No Breaklines

For whatever reason, the breaklines, which show up in explorer tree, do not add to map (all others do in Topographic Survey Data. https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L35

8 & 9 - Tier 1 and 2 Units based on channelunits.csv join

So this was kind of interesting... The symbology works and it adds the layer (which I am successfully adding 7 times to tree with different labels and symbology). However nothing is showing in map, because the layer file references a tier field in the topo projects Inputs/ChannelUnits.csv file. Why we never put these in the damn shapefile is a mystery. I joined them.

https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L14-L19

10. Unit ID label missing

I thought labels came over with UnitNum.lyr? This adds to map with right symbology, but the label customization are missing (just trying to show label for UnitID field number).
https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml#L11

11 & 12. Can't rename nodes

As with the Topography nodes, I cannot override any of the xpathlabel="name" with something custom (e.g. label="Digital Elevation Model), it breaks the business logic. It works for other ones though outside of these parent node.

Just taking a first look. @joewheaton you are "over specifying" the XPaths. In the following snippet from your topo business logic, you are trying to select nodes based on both their tag name (e.g. Detrended) and also their id (e.g. [@id='Detrended']).

<Node xpathlabel="Name" xpath="Realizations/Topography/TIN/Detrended[@id='Detrended']" type="raster" symbology="detrendDEM" />
<Node xpathlabel="Name" xpath="Realizations/Topography/TIN/DEM[@id='DEM']" type="DEM" symbology="DEM" />
<Node xpathlabel="Name" xpath="Realizations/Topography/TIN/DEMHillshade[@id='DEMHillshade']" type="Hillshade" symbology="" />

Only detrended DEMs will have the tag name Detrended so the ID filter can be omitted.

<Node xpathlabel="Name" xpath="Realizations/Topography/TIN/Detrended" type="raster" symbology="detrendDEM" />

Next issue... RAVE only understands node types of "raster", "vector" and "file" (and soon "TIN"). It does not understand the types "DEM" and "Hillshade". I know it's confusing... we have project XML types for these special rasters, but not RAVE business logic types. The symbology key will ensure that they are displayed correctly.

<Node xpathlabel="Name" xpath="Realizations/Topography/TIN/DEM" type="DEM" symbology="DEM" />

should be:

<Node xpathlabel="Name" xpath="Realizations/Topography/TIN/DEM" type="raster" symbology="DEM" />

Okay thanks... super helpful. I will make these changes locally here to learn and test. Question - should I make the fixes and commit them to https://github.com/Riverscapes/RaveAddIn/blob/master/RaveAddIn/XML/topo.xml or are you already doing that? I'm happy to. I just don't want to collide or duplicate.

You can make the fixes. I am making them locally, but good education for you to implement. I am in the midst of adding TINs.

OK, here's my biggest criticism yet!

You have flattened the topo project and grouped together items of different dimensionality.

There is a fundamental concept to the topo project. Note the word multiple below!!!!!!

Inputs
Realizations
    SurveyData
    Topography (MANY)
        TIN
            stages (MANY)
            DEM

Note that there can be many TINs within a topo project. Each TIN is a realization that owns its own DEM, associated surfaces etc. It then owns both a wetted and bankfull stages and all other derivative products.

Most topo projects only have one TIN realization. But crews often created several. The final TIN is identified with an active=true attribute.

If you want to truly reflect the topo project data you might need to reorganize your business logic along the same lines.

Remember that repeater business logic should be used when you don't know how many of something there will be (in this case TINs).

Note that commit 6667eea takes care of 1, 4, 5, 6 and 7.

@joewheaton a few things:

  1. I just pushed a fix to topo.xml to fix invalid dataset types in the business logic. Note the only types are "raster", "vector", "file" and now "tin". DEM and Hillshade are invalid.
  2. The previous point tells me that you don't have Visual Studio Code validation working. We need to fix this ASAP. This process is hard enough with validation, it's virtually impossible if we are exchanging invalid XML.
  3. Your layer files for vector are working for me. But your raster layers are not. Are you sure the DEM and detrended layer files were created with 10.4 as the version?

@philipbaileynar Thanks for fix on 1.

As for 2, that was my question about what XSD to use. I have a call in a few, but lets check in later this morning and I can show you what I'm doing.

Re, 3, yes I can confirm ALL were produced as 10.4 *.lyr files.

Closing this issue because it is old. Version 2.0.6 has much improved business logic working for topo projects. If there are outstanding problems displaying topo projects then please create new issues for each individual problem.