I followed the example below, but for the UK. For this reason, I use CRS for UK EPSG: 27700, which has the following forecast line:
"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs"
However, I'm not sure about the wgs.84 code. I am currently using:
"+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
Also tried to use datum = OSGB36 and + ellps = airy.
The full code is as follows:
library(rgeos) library(maptools) library(rgdal) epsg.27700 <- '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs' wgs.84 <- '+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0' coast <- readShapeLines("ne_10m_coastline",CRS(wgs.84))
When you try to complete the projection line, an error is displayed.
coast.proj <- spTransform(coast,CRS(Epsg.27700)) non finite transformation detected: [1] 111.01051 19.68378 Inf Inf Error in .spTransform_Line(input[[i]], to_args = to_args, from_args = from_args, : failure in Lines 22 Line 1 points 1 In addition: Warning message: In .spTransform_Line(input[[i]], to_args = to_args, from_args = from_args, : 671 projected point(s) not finite
I am having trouble understanding what I did wrong here.