mbtyers / riverdist

River Network Distance Computation and Applications
23 stars 2 forks source link

xy2segvert #21

Open jbenne64 opened 2 months ago

jbenne64 commented 2 months ago

Hi,

I am a grad student needing help with analysis using the riverdist package. I have a simple river shapefile (start to end, no tributaries) which I can successfully import into R using line2network function. I have checked the topology dots which occur at the start and end at the river as expected. I also have a csv file with station number, longitude and latitude. I am seeking advice on the coding required to determine the distance of from the start of river to each station. Both river shapefile and stations appear to have the same CRS.

My error seems to be related with xy2segvert function, whereby every seg, vert and snap distance generated is the same value. I have spent alot of time trying to go through the code and would appreciate any suggestions.

mbtyers commented 2 months ago

Hello!

From what you're describing, it sounds like all the stations are snapping to the same point, most likely the start or end vertex. My guess is that the shapefile and stations don't have the same coordinate system, or perhaps the x & y (or latitude & longitude) are switched somewhere.

I unfortunately can't reproduce the error you're encountering without the files you're working with - if you attach them here I can give it a try, or you can email them to matttyersstat@gmail.com.

It's also possible that you've found a bug; a simple network with no tributaries might create an edge case I haven't tested.

Matt