将 SpatialLines 对象从 lat/lon 投影到 utm

Projecting a SpatialLines object from lat/lon to utm

我使用 geosphere 包创建了 lat/lon 的大圆轨迹:

flightTraj  = greatCircle( c( originAptLon, originAptLat ), c( destinAptLon, destinAptLat ), n = nPts, sp = TRUE )

它的属性是:

class       : SpatialLines 
features    : 1 
extent      : -180, 180, -52.74719, 52.74719  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +ellps=WGS84 

我想使用 WGS84 椭球投影到 UTM zone 14 制图。我试过了:

projectedTrajectories  <- CRS("+proj=utm +zone=14 +datum=WGS84 +units=km +no_defs") %>% 
    spTransform( flightTraj, . )

但是,控制台显示:

non finite transformation detected:
  V1 lat  
  Error in .spTransform_Line(input[[i]], to_args = to_args, from_args = from_args,  : 
  failure in Lines 1 Line 1 points 
  In addition: Warning message:
  In .spTransform_Line(input[[i]], to_args = to_args, from_args =     from_args,  :
  6 projected point(s) not finite

任何帮助,请。

"All's well that ends well..."

distOrigDest = distGeo( c( originAptLon, originAptLat ), c( destinAptLon, destinAptLat ), a = earthRadius, f = earthFlattening ) / km2m 
nPts = 20 * floor( distOrigDest / cellCentroidDist )
flightTraj = gcIntermediate( c( originAptLon, originAptLat ), c( destinAptLon, destinAptLat ), n = nPts, sp = TRUE )
flightTraj  = spTransform( flightTraj, "+proj=utm +zone=14 +datum=WGS84 +units=km" )
plot( flightTraj, col= "blue", add = TRUE, lwd = 2 )