Skip to content
Back to formatted view

Raw Message

Message-ID: <74797575.sFe96nXzHv@ID-99504.news.uni-berlin.de>
Date: 2012-08-29T16:15:56Z
From: Karl Ove Hufthammer
Subject: Coordinate interpolation keeping NAs

Mario A. Pardo skreiv:

> lon <- c(-115.86, -115.83, NA, -115.78, -115.78, -115.75, NA, -115.68,
> -115.66)
> lat <- c(  29.76,   29.61, NA,   29.55,   29.53,   29.41, NA, 29.13,
> 29.09)
> 
> and I need a new set of coordinates c(new.lon, new.lat) with a higher
> resolution, following some interpolation criterium, but keeping the NAs
> where they should be, according to the original data.

For interpolation you could try the ?makeLine? function in the ?geosphere? 
package, which also takes into account the curvature of the Earth. But I?m 
not sure I understand what the NA values in your example are supposed to 
represent. If they represent breaks in the lines, I would just split the 
vectors before running ?makeLine?.

-- 
Karl Ove Hufthammer
E-mail: karl at huftis.org
Jabber: huftis at jabber.no