problems with points2grid
Yan, An alternative approach, if you want to force regularly spaced points to a grid that you know the parameters of, you could first create that grid and then link the values by cell numbers library(raster) r <- raster(ncol=10, nrow=10, xmn=.. xmx= etc) cells <- cellFromXY(r, xy) r[cells] <- value (not to be confused with pointsToRaster for random like distributions with perhaps multiple points per cell). Robert
On Mon, Nov 1, 2010 at 7:03 PM, Yan Boulanger <yan_boulanger at hotmail.com> wrote:
Hi
everyone,
This seems
(again) a very simple question but I?m not able to get this work. I have point
data from the Canadian National Forest Inventory. This inventory was realized
using a grid of 20 regularly spaced points. Even though I have access to the
point data, I don?t have the grid data. Actually, I would like to use the grid
data in order to do some moving window analyses. Plotting the point makes it
obvious that these were generated using a grid. I used the points2grid in order
to convert Grid. However, I get this error message :
library(rgdal)
nfi_centroid
<- readOGR(".", "nbie")
coord_nficentroid<-coordinates(nfi_centroid)
grid_new
<- points2grid(SpatialPoints(coord_nficentroid),
tolerance=sqrt(.Machine$double.eps), round=NULL, fuzz.tol=3)
suggested
tolerance minimum: 0.40961317562634
Erreur dans
points2grid(SpatialPoints(coord_nficentroid), tolerance =
sqrt(.Machine$double.eps), ?:
?dimension 1 : coordinate intervals are not
constant
However,
one could see that intervals are constant except, of course, when points fall
in water. I tried with a subset of points that excluded any point skipping due
to water and got that same result. I?m a little bit puzzled? I?m surely missing
something!
Thanks for
the help!
Yan
Using R
2.11.1
The original
projection was :
Projected
Coordinate System: NAD_1983_Albers
Projection:
Albers
False_Easting:
0,00000000
False_Northing:
0,00000000
Central_Meridian:
-95,00000000
Standard_Parallel_1:
49,00000000
Standard_Parallel_2:
77,00000000
Latitude_Of_Origin:
49,00000000
Linear
Unit: Meter
Geographic
Coordinate System: GCS_North_American_1983
Datum:
D_North_American_1983
Prime
Meridian: Greenwich
Angular
Unit: Degree
?Here?s
a subset of the point data for New Brunswick.
? ? ? ? ? ?coordinates Id
1 ? ? (2200320, 384479) ?0
2 ? ? (2192230, 366274) ?0
3 ? ? (2095010, 343514) ?0
4 ? ? (2165910, 356022) ?0
5 ? ? (2076780, 351499) ?0
6 ? ? (2184140, 348078) ?0
7 ? ? (2202370, 340149) ?0
8 ? ? (2157810, 337828) ?0
9 ? ? (2113240, 335544) ?0
10 ? ?(2149700, 319642) ?0
11 ? ?(2068680, 333298) ?0
12 ? ?(2176040, 329890) ?0
13 ? ?(2131470, 327586) ?0
14 ? ?(2105140, 317356) ?0
15 ? ?(2060570, 315108) ?0
16 ? ?(2167930, 311709) ?0
17 ? ?(2086910, 325320) ?0
18 ? ?(2194270, 321966) ?0
19 ? ?(2042340, 323093) ?0
20 ? ?(2078790, 307135) ?0
21 ? ?(2186160, 303791) ?0
22 ? ?(2123360, 309404) ?0
23 ? ?(2159810, 293539) ?0
24 ? ?(1981530, 284526) ?0
25 ? ?(2034220, 304904) ?0
26 ? ?(2141590, 301465) ?0
27 ? ?(1989650, 302709) ?0
28 ? ?(2222600, 287994) ?0
29 ? ?(2070670, 288956) ?0
30 ? ?(2097020, 299175) ?0
31 ? ?(2052450, 296924) ?0
32 ? ?(2007870, 294710) ?0
33 ? ?(2115250, 291229) ?0
34 ? ?(2088900, 281003) ?0
35 ? ?(2151690, 275374) ?0
36 ? ?(1963300, 292533) ?0
37 ? ?(2178040, 285625) ?0
38 ? ?(2026100, 286723) ?0
39 ? ?(1973390, 266350) ?0
40 ? ?(2206340, 251692) ?0
41 ? ?(2133470, 283295) ?0
42 ? ?(2169910, 267467) ?0
43 ? ?(2017970, 268551) ?0
44 ? ?(2196260, 277725) ?0
45 ? ?(2044320, 278750) ?0
46 ? ?(1999750, 276532) ?0
47 ? ?(2188130, 259573) ?0
48 ? ?(2036190, 260582) ?0
49 ? ?(2054410, 252625) ?0
50 ? ?(2107120, 273062) ?0
51 ? ?(1955170, 274350) ?0
52 ? ?(2214470, 269839) ?0
53 ? ?(2062550, 270788) ?0
54 ? ?(2125340, 265134) ?0
55 ? ?(2143560, 257219) ?0
56 ? ?(1991610, 258362) ?0
57 ? ?(2232690, 261965) ?0
58 ? ?(2080770, 262838) ?0
59 ? ?(2250900, 254106) ?0
60 ? ?(1965250, 248184) ?0
61 ? ?(2224550, 243825) ?0
62 ? ?(2072630, 244684) ?0
63 ? ?(2098990, 254904) ?0
64 ? ?(2109060, 228836) ?0
65 ? ?(2161770, 249317) ?0
66 ? ?(2009830, 250387) ?0
67 ? ?(2269110, 246260) ?0
68 ? ?(2117200, 246982) ?0
69 ? ?(2331860, 240924) ?0
70 ? ?(2179990, 241429) ?0
71 ? ?(2028050, 242424) ?0
72 ? ?(2135420, 239072) ?0
73 ? ?(1983470, 240202) ?0
74 ? ?(2242760, 235970) ?0
75 ? ?(2090840, 236753) ?0
76 ? ?(2198200, 233554) ?0
77 ? ?(2046270, 234474) ?0
78 ? ?(2305520, 230608) ?0
79 ? ?(2260960, 228130) ?0
80 ? ?(1957100, 230026) ?0
81 ? ?(2234610, 217843) ?0
82 ? ?(2315560, 204691) ?0
83 ? ?(2163690, 205166) ?0
84 ? ?(2216410, 225692) ?0
85 ? ?(2064480, 226536) ?0
86 ? ?(2323720, 222803) ?0
87 ? ?(2171840, 223293) ?0
88 ? ?(2019900, 224274) ?0
89 ? ?(2279170, 220303) ?0
90 ? ?(2153630, 231176) ?0
91 ? ?(2001690, 232232) ?0
92 ? ?(2100910, 210701) ?0
93 ? ?(1948950, 211877) ?0
94 ? ?(2127270, 220933) ?0
95 ? ?(1975320, 222049) ?0
96 ? ?(2082690, 218612) ?0
97 ? ?(2190050, 215424) ?0
98 ? ?(2038110, 216330) ?0
99 ? ?(2297370, 212490) ?0
100 ? (2145480, 213043) ?0
101 ? (2252810, 210010) ?0
102 ? (2208250, 207567) ?0
103 ? (2056330, 208398) ?0
104 ? (2165550, 161088) ?0
105 ? (2281040, 176281) ?0
106 ? (2129150, 176804) ?0
107 ? (2272870, 158190) ?0
108 ? (2271010, 202188) ?0
109 ? (2119110, 202803) ?0
110 ? (2074540, 200480) ?0
111 ? (2226450, 199725) ?0
112 ? (2066370, 182357) ?0
113 ? (2147350, 168939) ?0
114 ? (2254680, 165986) ?0
115 ? (2181890, 197303) ?0
116 ? (2029960, 198195) ?0
117 ? (2289210, 194380) ?0
118 ? (2137320, 194919) ?0
119 ? (2244650, 191898) ?0
120 ? (2092740, 192575) ?0
121 ? (1940780, 193737) ?0
122 ? (2200090, 189452) ?0
123 ? (2048160, 190269) ?0
124 ? (2155520, 187049) ?0
125 ? (2262850, 184082) ?0
126 ? (2110950, 184683) ?0
127 ? (2218290, 181616) ?0
128 ? (2173720, 179191) ?0
129 ? (2120980, 158699) ?0
130 ? (2236480, 173795) ?0
131 ? (2084580, 174458) ?0
132 ? (2191920, 171347) ?0
133 ? (2039990, 172149) ?0
134 ? (2299230, 168494) ?0
135 ? (2102780, 166572) ?0
136 ? (2210120, 163517) ?0
137 ? (2058200, 164243) ?0
138 ? (2228310, 155700) ?0
139 ? (2094600, 148470) ?0
140 ? (2076400, 156350) ?0
141 ? (2220130, 137616) ?0
142 ? (2068220, 138252) ?0
143 ? (2183750, 153250) ?0
144 ? (2112800, 140604) ?0
145 ? (2139170, 150840) ?0
146 ? (2246500, 147898) ?0
147 ? (2201940, 145427) ?0
148 ? (2050020, 146139) ?0
149 ? (2157370, 142996) ?0
150 ? (2264680, 140109) ?0
151 ? (2193750, 127345) ?0
152 ? (2203740, 101476) ?0
153 ? (2175560, 135164) ?0
154 ? (2130990, 132751) ?0
155 ? (2238310, 129820) ?0
156 ? (2086410, 130378) ?0
157 ? (2149180, 124911) ?0
158 ? (2256490, 122037) ?0
159 ? (2104610, 122518) ?0
160 ? (2211930, 119542) ?0
161 ? (2060020, 120164) ?0
162 ? (2167370, 117086) ?0
163 ? (2122800, 114671) ?0
164 ? (2230120, 111751) ?0
165 ? (2078220, 112296) ?0
166 ?(2187320, 65377.6) ?0
167 ?(2160920, 55121.2) ?0
168 ? (2185550, 109274) ?0
169 ? (2140980, 106838) ?0
170 ? (2248300, 103974) ?0
171 ? (2096410, 104442) ?0
172 ?(2240090, 85921.7) ?0
173 ? ?(2088200, 86376) ?0
174 ?(2124570, 70720.6) ?0
175 ? ?(2159170, 99019) ?0
176 ?(2114600, 96602.2) ?0
177 ?(2221920, 93691.9) ?0
178 ?(2070010, 94223.2) ?0
179 ?(2177350, 91213.9) ?0
180 ?(2132780, 88774.2) ?0
181 ?(2195530, 83422.5) ?0
182 ?(2150960, 80962.3) ?0
183 ?(2106390, 78541.3) ?0
184 ?(2213710, 75643.1) ?0
185 ?(2169140, 73162.6) ?0
186 ?(2205490, 57605.4) ?0
187 ? ?(2079990, 68319) ?0
188 ?(2142750, 62914.6) ?0
189 ?(2116350, 52677.1) ?0
190 ?(2179100, 47343.4) ?0
191 ?(2134520, 44877.3) ?0
192 ?(2170870, 29318.1) ?0
193 ?(2152700, 37090.6) ?0
194
(2198950, -4186.01) ?0
Yan Boulanger
Dendrolab - Datation de b?timents patrimoniaux par dendrochronologie
www.dendrolab.ca
info at dendrolab.ca
Universit? du Qu?bec ? Rimouski
D?partement de Biologie
Centre d'?tudes nordiques
300, all?e des Ursulines
Rimouski, PQ G5L 3A1
(418) 723-1986 poste 1482
? ? ? ?[[alternative HTML version deleted]]
_______________________________________________ R-sig-Geo mailing list R-sig-Geo at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo