Skip to content
Prev 23013 / 29559 Next

imprecise location extraction

Sorry Robert, the following two lines (just before ggplot() ) got lost
somewhere along the way:
coord.df=as.data.frame(coords)
names(coord.df)=c('Long','Lat')

However, you are correct that the data I posted isn't giving the same
issue. I suspect it has to do with how the coordinates are being pasted
into email because I still get the issue with my original dataset if I do
as below (where snotellocs is the original version of snotellocs.sub). I
haven't managed to recreate the issue by typing in the coordinates manually.

tmp=data.frame(coordinates(snotellocs),extract(coordstack,snotellocs))
tmp=mutate(tmp,
    latdiff=Latitude-layer.2,
    longdiff=Longitude-layer.1)
tmp$latflag2=ifelse(tmp$latdiff>15/3600/2,1,0)
tmp$longflag2=ifelse(tmp$longdiff>15/3600/2,1,0)
ind=which(tmp$latflag2==1)
tmp[ind,]
Longitude Latitude   layer.1  layer.2     latdiff      longdiff latflag2
6   -112.0623 35.26247 -112.0604 35.26028 0.002192222 -1.893333e-03        1
18  -111.6506 35.34160 -111.6521 35.33944 0.002155556  1.503333e-03        1
21  -110.9177 33.81242 -110.9188 33.81028 0.002142222  1.020000e-03        1
62  -105.6307 40.57913 -105.6312 40.57694 0.002185556  5.700000e-04        1
83  -108.0584 39.05831 -108.0604 39.05611 0.002198889  2.066667e-03        1
89  -106.5584 37.96661 -106.5604 37.96444 0.002165556  2.046667e-03        1
91  -105.9558 40.40405 -105.9562 40.40194 0.002105556  4.200000e-04        1
104 -106.0833 39.03333 -106.0812 39.03111 0.002218889 -2.080000e-03        1
116 -106.6768 40.53743 -106.6771 40.53528 0.002152222  2.833333e-04        1
139 -111.9564 42.52497 -111.9562 42.52278 0.002192222 -1.000000e-04        1
141 -111.2980 42.56248 -111.2979 42.56028 0.002202222 -5.333333e-05        1
156 -108.2667 35.23333 -108.2687 35.23111 0.002218889  2.080000e-03        1
164 -105.1947 36.47493 -105.1937 36.47278 0.002152222 -9.300000e-04        1
170 -111.0978 40.61238 -111.0979 40.61028 0.002102222  9.666667e-05        1
174 -110.5825 40.95833 -110.5812 40.95611 0.002218889 -1.300000e-03        1
214 -110.7462 39.89165 -110.7479 39.88944 0.002205556  1.766667e-03        1
223 -109.2896 38.48323 -109.2896 38.48111 0.002118889 -1.666667e-05        1
230 -111.3182 39.68333 -111.3187 39.68111 0.002218889  5.700000e-04        1
262 -107.2661 41.05413 -107.2646 41.05194 0.002185556 -1.506667e-03        1
281 -109.8782 43.38332 -109.8771 43.38111 0.002208889 -1.066667e-03        1
    longflag2
6           0
18          0
21          0
62          0
83          0
89          0
91          0
104         0
116         0
139         0
141         0
156         0
164         0
170         0
174         0
214         0
223         0
230         0
262         0
281         0

Dominik Schneider
o 303.735.6296 | c 518.956.3978


On Thu, Jun 25, 2015 at 10:46 AM, Robert J. Hijmans <r.hijmans at gmail.com>
wrote: