Imports Stream Centerlines, no errors, but only two Endpoints show, at 0,0 ?

0 votes
56 views
asked Jun 14 by Loren Amelang

I have a 63 node river line in my QGIS project, that looks good on the screen and follows the rules for numbering in the downstream direction. Names are unique and junctions match perfectly (though I'm only trying to import the first reach right now). It seems to import:

Import data into RAS PostGIS tables...

Importing data from Stream, Walker Creek...

OK

Imported layers:

Stream Centerlines


Building stream centerlines topology...

Done.


Calculating river reach(es) lengths and their end stations...

Done.

But in the new PostGIS layer there are only two nodes, and nothing is drawn on the screen.

Encoding
System
Geometry
Line (LineString)
CRS
EPSG:2226 - NAD83 / California zone 2 (ftUS) - Projected
Extent
-123.3397666000000044,39.3146324000000007 : -123.3133907999999934,39.3210203000000007
Unit
feet
Feature count
2  --> But Layers -> Show Feature Count says 0 ???

The new extent lat,lon matches the begin and end nodes of the input file exactly. But where are my intermediate points?

Wait! I'm not sure how, but suddenly my screen shows the River name and two superimposed Endpoints with numbers 1, 2  - all at Coordinates 0,0! Zoom to Layer won't take me back there if I move off a ways...  But as you can see above, the file includes the proper coordinates and CRS. Some parts of my import file are coming in but others aren't... 

I'm new to QGIS 3.0.3 and RiverGIS 3.0, so maybe I'm doing something stupid. Or maybe the ~6000 lines of Python errors I get on QGIS startup are leaving problems for me. Or maybe Windows 10 64-bit is not well tested... 

Any clues would be most welcome!

commented Jun 14 by rpasiok (3,601 points)
Can you share your input data?
commented Jun 15 by Loren Amelang
Thank you for the quick reply!

Back at this today, I noticed three seemingly identical Endpoints layers along with my Centerlines layer. Deleted two of them. Now Zoom to Layer on the NodesTable shows my riverline with 1 at the top and 2 at the bottom, at lon/lat 123,39 coordinates. If I'm already seeing the NodesTable, Zoom to Layer on the remaining Endpoints layer goes to the "2" end of that line.

But the rest of my layers outside the newly imported ones show coordinates like 6185393,2243502. If I'm already seeing my sat images and roads, Zoom to Layer on the remaining Endpoints layer goes to 0,0 and the superimposed points. Zoom to Layer on the Centerlines layer still does nothing from any current layer. Looks like maybe a CRS problem...

I just removed the weird files and tried again, and RiverGIS showed this:
---
Current projection is EPSG:2226
Connection established.
Created connection to river database: rivergis@127.0.0.1
Current DB schema is: ridge1
There are some objects registered in the database.

Import data into RAS PostGIS tables...
Importing data from Stream, Walker Creek...
OK
Importing data from BankLines...
ProgrammingError('syntax error at or near ";"\nLINE 4:  ;\n         ^\n',)
OK
  Imported layers:
    Stream Centerlines
    Levee Alignment
---

I had left everything blank except for Stream Centerlines. Last time that's all it imported. This time it created a Levee Alignment layer with no features and only "Levee ID" in the table. The new StreamCenterlines layer looks just like the old one, at lat/lon coordinates, but the Zoom to Layer works every time. No Endpoints or NodesTable were added this time...  

There is no place in the RiverGIS dialog to select input CRS. QGIS knows that the input file is EPSG:4326, and all the created files are EPSG:2226 like the project. Is there something else I need to set?

There is another QGIS quirk...  Their "testing" doc shows an "Enable ‘on the fly’ CRS transformation" choice in both Project Properties and Settings Options, but my 3.0.3 version has neither.
https://docs.qgis.org/testing/en/docs/user_manual/working_with_projections/working_with_projections.html#define-on-the-fly-otf-crs-transformation

I have to assume mine is on, or none of my other layers would be lining up properly...  

I also have a bug where I can't Create a Shapefile Layer:
https://issues.qgis.org/issues/19158#change-90347

I saved the input file out of QGIS instead of sending you the original I imported. Imported it back in and it displays properly. Walker Creek line (SaveAs).zip

Oh - no file option here...  It is at:
http://www.psychoros.com/x/Walker_Creek_line.zip

Will be very interested to hear what you find!
commented Jun 15 by Loren Amelang
Still at this...

I set Project -> Project Properties -> General -> Coordinate display to Decimal Degrees instead of Map Units. Now all my layers show lat/lon in the QGIS status bar mouse position box. All layers show -123,39 values, EXCEPT the RiverGIS StreamCenterlines layer which shows -142.9544,31.0960 no matter where in the window the mouse is! At Scale 24:1! (Should be 1:11822...) And yes, if I zoom out far enough from my other layers, there is the Centerline, way out in the ocean and south at those coordinates! And now that I've manually zoomed to include those coordinates, I can do the reverse - zoom to the Centerline, and then zoom way out until I see the rest of the project.

I guess that explains why the Reach Length attribute is 0.0314831796273955. The layer properties say:
EPSG:2226 - NAD83 / California zone 2 (ftUS) - Projected
-123.3397666000000044,39.3146324000000007 : -123.3133907999999934,39.3210203000000007

But if I use the QGIS Identify tool on the mid-ocean Centerline, it shows:
---
ReachID: 1
RiverCode: Walker Creek
ReachCode:
FromNode: 1
ToNode: 2
ReachLen: 0.0314831796273955
FromSta: 0
ToSta: 0.0314831796273955
firstX  -142.9544
firstY  31.0960
lastX  -142.9544
lastY  31.0960
---

But the Identify tool can separate the 63 Vertices along the line! Shows the same coordinates for all of them, but it knows they exist!

The PostGIS browser at
http://127.0.0.1:1736/browser/#
shows the same 3 data rows as the QGIS Properties. No table with 63 Vertices, that I can find. So where can QGIS be getting the line shape it shows on the map? It really does have all the kinks and curves of the real stream, though a bit warped.

1 Answer

0 votes
answered Jun 15 by rpasiok (3,601 points)

1. In QGIS 3 the On-the-fly reprojection is always ON.

2. All your data must be in a projected CRS (coordinate reference system) - reproject it to EPSG:2226 or similar.

3. You need to set the same CRS for your data and the plugin.

commented Jun 16 by Loren Amelang
Thank you so much!

I reprojected all my streams, merged them, and re-imported them, looked good. It updated my previous Nodes table with the new streams, but that still ended up mid-ocean.

So I deleted all your RiverGIS and PostGIS layers, and started over:

Running Create RAS Layers and Tables...
  StreamCenterlines OK
  XSCutLines OK
  Flowpaths OK

Import data into RAS PostGIS tables...
Importing data from Merged...
OK
  Imported layers:
    Stream Centerlines

Now there are two identical-looking Stream Centerlines layers in QGIS (only one in PostGIS). I'm assuming they are two views of the same file? Both seem to get updated when I add things.  

Building stream centerlines topology...
Done.

New NodesTable (How did it know the flow directions? From the line segment order? )

Calculating river reach(es) lengths and their end stations...
Done.

New Endpoints layer

Copying stream centerlines into flowpaths...
Done.

(Nothing obvious happened) Flowpaths file has 2 FpID entries called channel...  


I guess I'm ready to create cutlines! I found this - thank you again!

<http://q2a.rivergis.com/125/creating-xscutline>
You could try SAGA processing algorithm: Cross Profiles.


In QGIS 3.0.3:
Processing -> Toolbox -> SAGA -> Terrain Analysis - Profiles -> Cross profiles

Looks like exactly what I need. But it errors:
'50.0' is not a correct numeric value for option 'NUM_PROFILE'.

Tried the default:
'10.0' is not a correct numeric value for option 'NUM_PROFILE'.

Looks like NUM_PROFILE parameter is different:
Usage: saga_cmd ta_profiles 3 [-DEM <str>] [-LINES <str>] [-PROFILES <str>] [-DIST_LINE <double>] [-DIST_PROFILE <double>] [-NUM_PROFILE <num>]

-NUM_PROFILE:<num> Profile Samples
Integer
Minimum: 3
Default: 10

I tried to delete the decimal point and zeros from the SAGA dialog, but it puts them right back! I guess that would be a QGIS bug?

Yes:
<https://issues.qgis.org/issues/18870>
-----
the problem appears to be caused by a Real format value being supplied where an Integer value is required
Applied in changeset qgis|c2f224b4462887bcc252a48b2c3c602bf5aee6bc.
-----

But they only fixed the specific one that was reported:
---
python/plugins/processing/algs/saga/description/ChannelNetworkandDrainageBasins.txt

QgsProcessingParameterNumber|THRESHOLD|Threshold|QgsProcessingParameterNumber.Double|5.0|False|None|None
to:
QgsProcessingParameterNumber|THRESHOLD|Threshold|QgsProcessingParameterNumber.Integer|5|False|1|None
---

Filed mine:
https://issues.qgis.org/issues/19205


I'd first thought maybe the DEM needed to be explicitly reprojected to my project's EPSG:2226, but that added a new warning:

warning: top-to-bottom and left-to-right cell sizes differ.
Difference: 6.669547

using cellsize: 26.677698

Apparently that was not a good thing to do.


I realize this is way beyond your responsibility, but maybe it will help someone who finds this page in the future.
commented Jun 29 by Loren Amelang
The QGIS Processing -> Toolbox -> SAGA -> Terrain Analysis - Profiles parameter issue is now fixed in 3.2.
Welcome to RiverGIS Q&A, where you can ask questions and receive answers from other members of the community.

Visit rivergis.com for documentation and general info about the QGIS plugin.
...