[R] Opening shapefiles in R

Nick Wray n|ckmwr@y @end|ng |rom gm@||@com
Fri Oct 21 13:25:18 CEST 2022


Hello

I have managed to download and plot the outline for the River Tweed In the
Sottish borders)  catchment using this code.  21009 is a zipfile downloaded
from the FEH website https://fehweb.ceh.ac.uk/Map:

require(rgdal)

shape <- readOGR(dsn ="C:/Users/nick/Desktop/PhD Oct 22", layer = "21009")

shape

plot(shape)

and I get an outline of the Tweed catchment which I can use

the zipfile has eight documents all with the name “21009.” and the suffixes
cpg/dbf/prj/sbn/sbx/shp/shp/shx   There are two .shp docs, one labelled as
SHP file and one as XML file.

However

I then have downloaded a file of a plot of all the rivers in the uk from
https://osdatahub.os.uk/downloads/open

I’ve put this data into a zipfile with the name “rivers”   Within this are
eight docs – four with the names HydroNode. and suffixes dbf/prj/shp/shx
and four with the name WatercourseLink. and the four suffixes.

Just subbing in “rivers” for “21009” in my code above doesn’t work and I
can’t find a way of getting into the shapefiles and opening them


I'd be grateful if anyone can help me get further with this

Thanks Nick Wray

	[[alternative HTML version deleted]]



More information about the R-help mailing list