1

I created a great-circle trajectory of lat/lon using the geosphere package:

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

Its properties are:

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

I want to project to a UTM zone 14 cartography with WGS84 ellipsoid. I tried:

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

But, the console displayed:

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

Any help, please.

4

1 回答 1

0

“一切都好,结局好……”

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 )
于 2017-02-15T22:53:31.967 回答