I am pretty new to the topic and OK with R, but spatial data is still terra incognita
I got a Mapinfo file and i had to convert it to ESRI shp and then within r into spatial lines data frame and use with leaflet+OS maps epsg:3857
whatever i tried within R with spTransform (rgdal) it did not work - either was not visible or was visible with offset (approx 20 meters). Proj4 did not want to work with SLDF. I took the file into Manifold, converted it to 3857, returned to R, transformed it to epsg:4269 and it works perfectly OK with leaflet + OS map 3857. But i have to automate this process to work within R, without any Manifold intervention.
I checked how the files differed: i selected one item (the same of course) from the file and to make it easy to present created a centroid for it. Then I checked projection, xy, and latlong.
the item created from the file without using Manifold: proj4string
"+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs"
centroid after spTransform to 4269
the item from the file pre-processed by Manifold: proj4string
"+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs"
centroid after spTransform to 4269:
the latter is correct of course. Just to emphasize - it is the same file and the same item
any idea what happens in Manifold that fails in rgdal?
is there any mechanism in R that I can apply to fix the error (to match the 'with Manifold' output)? Maybe a kind of offset or work on prj files?
I tried to use the latter CRS for transformation
P5 <-spTransform(ptp.points1P, CRS( "+proj=merc +lon_0=0 +lat_ts=0 +x_0=0 +y_0=0 +a=6378137 +b=6378137 +units=m +no_defs"))
and it returned still incorrect values the xy is t least inverted but shifted
the latlong is of course incorrect, but the same as without any attempt to transform
content of prj file not transformed - failing to correctly show
content of prj manifold transformed file - good to go