Good evening to all.
I find myself trying to create some Thiessen Polygons, in order to finish a
meteorology research.

This is the script I found to create the Polygons:
*
*
*voronoipolygons <- function(x) {*
*  require(deldir)*
*  if (.hasSlot(x, 'coords')) {*
*    crds <- x@coords  *
*    } else crds <- x*
*  z <- deldir(crds[,1], crds[,2])*
*  w <- tile.list(z)*
*  polys <- vector(mode='list', length=length(w))*
*  require(sp)*
*  for (i in seq(along=polys)) {*
*    pcrds <- cbind(w[[i]]$x, w[[i]]$y)*
*    pcrds <- rbind(pcrds, pcrds[1,])*
*    polys[[i]] <- Polygons(list(Polygon(pcrds)), ID=as.character(i))*
*    }*
*  SP <- SpatialPolygons(polys)*
*  voronoi <- SpatialPolygonsDataFrame(SP, data=data.frame(x=crds[,1],*
*                                                          y=crds[,2],
row.names=sapply(slot(SP, 'polygons'), function(x) slot(x, 'ID'))))*
*  }*

But I keep getting the same problem:

*Error en data.frame(x = crds[, 1], y = crds[, 2], row.names =
sapply(slot(SP,  :
  row names supplied are of the wrong length*


When the functions applies the deldir() the amount of rows that I get is
less than you can find in the coordinates. So, at the end, when I want to
create the object with all the information, the error pop's up because the
number of rows in x & y = crds[, 1 & 2] are higher than the one found in SP
object just created.

If anyone can help me, I'll appreciate it.
I leave you the coordinates that I'm using, they are 280.

Thank so much.

UTM_E UTM_N
233293 6049544
235305 5870127
235733 5825702
237429 6013790
238456 5869485
243466 5921477
243901 5822534
245489 5648450
245651 5991450
247216 6078914
247246 5740486
248584 6221061
249303 6054945
249734 5941253
249956 6036241
250025 5870980
250841 5882544
251917 6073278
253631 6249870
253643 5766299
255253 5653053
256341 6281850
257884 6018449
257929 5642612
258768 6340116
259253 6057656
259503 6145308
261645 6329674
262182 6075406
262260 5973011
262808 5924320
264306 5831657
264442 5916375
264487 5739282
264566 6000309
264566 6000309
264657 5971103
264731 5661122
265580 6030839
267128 6275490
270214 5801126
270568 6089995
270578 5910343
271060 5984598
271712 6391282
272001 5950850
273738 6368953
274208 5948317
275321 5738790
275383 6309718
276314 6437892
276430 5911949
276590 6413583
278177 5640252
278543 6203317
278701 5696644
279084 6148544
279176 5987645
279334 5838550
280800 6350896
280981 5622434
281494 6329121
281652 6204962
282440 6055015
283173 5981671
284533 6166863
284697 6004930
286321 5941349
286618 6314194
287907 6367232
288037 6293143
288579 6095832
288861 6423216
289695 6069804
290252 6212896
291934 5940438
291973 6070536
292532 6408901
292616 6023684
292770 6247629
292821 6023473
292831 5741698
293336 6335543
293356 6358041
293993 6384988
294633 5938745
295308 6053778
296074 6271064
296947 6177194
298056 6226383
298523 6429484
299821 6327912
300007 6398391
300739 6262347
303116 6414199
303912 6341092
304239 6423711
304504 6283506
304786 6150390
306249 6410346
306310 6222857
306637 6231926
308542 6203948
308556 6440339
308753 6046524
308838 6028644
309233 6090157
310416 6364546
310925 6059118
311620 6185795
311657 6427210
311699 6298195
312059 6047150
312684 6426891
313364 6030653
313778 6346307
314501 6078522
317952 5719729
318463 6404043
318756 6376442
319466 6169677
319780 6410660
321707 6269850
321775 6344884
324533 6392967
326123 6257882
326365 6248857
328455 6189449
330115 6448825
331135 6353060
331232 6292177
331337 6286171
331839 6337728
331872 6437764
331897 6433051
332727 6156581
334907 6338859
335037 6420380
336070 6353112
336404 6421604
336501 6187899
337307 6374237
338408 6375364
338660 6215240
338866 6432887
340404 6395390
341945 6411865
342326 6230308
347149 6297712
349988 6382600
350240 6365969
351271 6207960
351459 6402800
351664 6403111
352877 6272845
357081 6303810
357201 6210055
357349 6299624
357723 6311121
358743 6364246
359131 6292595
359235 6299620
362172 6282102
362268 6363187
365026 6306665
370122 6306396
372023 6281962
373099 6309978
373099 6309978
373275 6356403
373401 6198518
374507 6277311
377703 6209636
382842 6289061
385240 6261211
389224 6248289
399083 6273104
118350 5697430
113310 5807400
113516 5806140
115884 5842850
116100 5842460
130113 5730750
123237 5867130
139356 5706850
146486 5673610
146962 5672150
133684 5915050
135559 5915320
136724 5917720
140200 5917740
148730 5786530
141984 5917850
156799 5700430
157125 5700160
151449 5806540
147129 5938200
158264 5770250
149864 5917060
147980 5948430
164940 5719620
153168 5925570
170198 5741490
163848 5957520
170093 5869630
184557 5660090
180303 5759380
168497 5955940
178705 5808120
178705 5808120
187338 5681490
179667 5812350
187678 5707170
187981 5705600
175903 5941370
190823 5709020
182828 5837950
180254 5931500
178557 5963640
195327 5712100
189102 5843720
199024 5730920
195868 5783360
201553 5736630
198144 5792460
199045 5793200
191222 5938230
205144 5741980
194372 5925970
193043 5952010
200464 5860900
192036 5998060
208250 5762910
205568 5840640
205171 5858810
206804 5834880
197428 5984820
195507 6022190
204860 5876770
221890 5624050
210596 5833230
210694 5833970
218647 5715120
213518 5820520
222682 5682870
217262 5805770
217322 5839230
226698 5778370
234443 5678610
211949 6035430
220441 5941340
223993 5903190
238865 5686940
222765 5943320
222675 5945330
227634 5883950
237222 5742080
239063 5713960
237202 5742660
221755 6005220
219738 6062730
227094 5976390
223771 6191060
263332 6341790
257580 6273030
356150 6297270
343585 6298110
333396 6287190
297622 6128440
228020 5946620
137432 5921920
184011 5702460
58385 5893175
52035 5858250
48067 5820150
49654 5777288
54417 5737600
76642 5708231
98073 5689975
287584 6688350

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to