Closed damianooldoni closed 3 years ago
@damianooldoni, indeed. However, if I will now add networks from other river systems in Europe, the code will calculate distances between receivers from the various networks. For instance, if I add a network from the River Stour in the UK, the code will not only calculate distances between the receivers in that River Stour, but also the distances between the receivers from the River Stour with the Belgian network. This may lead to a substantial calculation time. Therefore, it would be an added value to indicate clusters within what river systems calculations should be made. For instance
As the rivers within the networks are not stored anywhere, the code of Stijn asks the user to provides them (prepare_dataset.R#L32-L40).
So, it's up to you to change this vector which will afterwards be used in function load.shapefile()
as value of argument subset.names
. See commented example here.
To adapt the example to river Stour:
nete <- load.shapefile("./data/europe_water/Europe_Water_2008.shp",
"Europe_Water_2008",
coordinate.string,
subset.names = "Stour")
So, if you start from the big shapefile Europe_Water_2008.shp
and the vector of the river names you are interested to, then the problem is solved? Obviously if you need to do this a lot of times, better to save a subset of shapefiles separately instead of loading the big shapefile of all Europe. But this is another story.
@damianooldoni I will upload various river shapefiles (not all waterways are stored in the Europe_Water_2008.shp
) and will use the gUnion()
functionality to combine relevant networks (e.g. Zeeschelde and Westerschelde networks). I started and created a branch to calculate distances between receivers from the River Frome (UK). However, for some reason R is unable to open the shapefile with the river 'line'. However, the shapefile is stored in the correct folder (data
). According to GIS, the layer name is Statutory_Main_River_Map
. Any thoughts why it won't upload? A bug in the load.shapefile()
functionality (although it seems straight forward and correct).
Could you please upload some data? It is difficult to solve it without working on those files... By the way, this seems out of scope in this issue. Could you please open a new issue about it? You can always refer to it.
@PieterjanVerhelst asked:
@PieterjanVerhelst : indeed, the code of Stijn is highly reusable, I found. In R script
prepare_dataset.R
you can chooseriver.names
and if you have the big file/data/europe_water/Europe_Water_2008.shp
you can try to load it in. If you can tell me where I can find it, I would like to test further. You want to limit to receivers in same network, the Stijn's code is river name based, but I don't find a big issue, isn't? I mean, once you know which rivers you are interested to.