I have a river network (blue line in the below image) and I need to simplify this based on a grid. I basically need to snap the river to the closest vertex or middle-of-side of the grid cell's bounds (grey dots) so the simplified river is that shown in red.
The ultimate goal is so that I can create this type of representation of the river in data (to input to a model), that describes the network as a series of river reaches (within grid cells) that are linked by pointing to their inflow grid cells.
"GridCell_1_1": {
"RiverReach_1_1_1": { ... }
},
"GridCell_1_2": {
"RiverReach_1_2_1": { "inflow": "RiverReach_1_1_1" }
},
"GridCell_2_1": {
"RiverReach_2_1_1": { ... }
},
"GridCell_2_2": {
"RiverReach_2_2_1": { "inflow": "RiverReach_1_2_1" },
"RiverReach_2_2_2": { "inflow": "RiverReach_2_1_1" }
}
How can I achieve this using QGIS?