Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to open shapefile containing data on the River Frome #59

Closed
PieterjanVerhelst opened this issue Aug 6, 2020 · 6 comments
Assignees

Comments

@PieterjanVerhelst
Copy link
Collaborator

I want to calculate the distances between receivers from the River Frome, hence, I created a branch distance-frome in which I uploaded the shapefile Statutory_Main_River_Map.shp in the folder \scripts\receiver_distance_analysis\data\UK\Frome.
When I run the code (line 69 - 73 in script prepare_dataset.R):

# RIVER FROME (UK)
frome <- load.shapefile("./data/UK/Frome/Statutory_Main_River_Map.shp",
                         "Statutory_Main_River_Map",
                         coordinate.string)

I get the following error:

 Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv,  : 
  Cannot open data source 
@PieterjanVerhelst PieterjanVerhelst changed the title Open shapefile containing data on the River Frome Error when trying to open shapefile containing data on the River Frome Aug 6, 2020
@damianooldoni
Copy link
Member

Thanks @PieterjanVerhelst. I will check it next week.

@PieterjanVerhelst
Copy link
Collaborator Author

Just FYI: I added the file receivernetwork_frome_2014.csv in the folder \fish-tracking\scripts\receiver_distance_analysis\data containing the coordinates of the detection stations in the River Frome. Hence, when the issue is fixed to upload the frome-shapefile, running the rest of the code should result in the distance matrix between the Frome stations (obviously after setting the correct file name at line 88 in prepare_dataset.R).

@PieterjanVerhelst
Copy link
Collaborator Author

@damianooldoni just a kind reminder ;-)

@damianooldoni
Copy link
Member

Thanks @PieterjanVerhelst, I definitely needed a reminder, especially if it is a kind one 😆
I give a look on it immediately.

@damianooldoni
Copy link
Member

.shp files are not enough to load shapes in R, you need also files with other extensions (dbf, prj, shx) which are generated together. You can see some examples in other directories, like yours here:
https://github.com/inbo/fish-tracking/tree/master/scripts/receiver_distance_analysis/data/PJ_manual_water

Maybe you can consider to save your shapefiles as as geojson? See this nice INBO tutorial about it:
https://inbo.github.io/tutorials/tutorials/spatial_standards_vector/#how-to-make-and-use-geojson-files-geojson
geopackages are also possible (1st part of the tutorial)

@PieterjanVerhelst
Copy link
Collaborator Author

Thanks, that was indeed the problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants