I am trying to convert a global map shapefile from a geographical coordinate system (lat/long, WGS84) into UTM projection using the following code:
setwd = "~/Desktop/Maps"
wmap = readOGR(dsn="world_map", layer="world_map")
wmap_utm = spTransform(wmap, CRS("+proj=utm"))
Unfortunately, I keep getting the following error code:
non finite transformation detected:
[1] 111.01052 19.68381 Inf Inf
Error in .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, :
failure in Polygons 3 Polygon 1 points 1
In addition: Warning message:
In .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, :
686 projected point(s) not finite
I have read both of the following questions on this topic, but both are related to small data examples rather than shapefiles with lots of data points: rgdal package lat/long -> UTM ; "Non Finite Transformation Detected" in spTransform in rgdal R Package. I have some polygon files in UTM format that I wish to add to the map and I really need a UTM projection. Any advise on what I might be doing wrong or ways to rectify the problem would be greatly appreciated.