[R-sig-Geo] Overlay on raster loses points when merging with data frame

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Aug 25 08:19:14 CEST 2009


Without being able to look over your shoulder I feel a bit like I have
to guess here. Is it possible that some points are outside the grid
(removed by remove.na.rows)? Is it possible that in some instances two
ore more points end up in the same grid cell (removed by unique)?
--
Edzer

Mehdi Khan wrote:
> Hello everyone.  I have overlayed 1611 points on top of a tif file.
>
> tifclassoverlay<-overlay(CRS11, classifiedmodrobin)
>
> overlaydf<-as.data.frame(tifclassoverlay)
>
> tifol<-remove.na.rows(overlaydf)
>
>
> tifol is 854 rows long.   tifol has predicted data, while the
> classifiedmodrobin matrix has observed data.  When I try to merge the two, I
> get a length of 827:
>
>  ngafulldf<-as.data.frame(classifiedmodrobin)
>
>  NGAfiledata<-merge(tifol, ngafulldf,all=FALSE, by=c("LON", "LAT"))
>
> NGAfiledata<-unique(NGAfiledata)
>
> NGAfiledata<-remove.na.rows(NGAfiledata)
> The length should obviously still be 854.  What happened to the missing
> rows?  How can I get them back?  Thank you very much!! Here is a sample of
> what the data looks like:
>         LON     LAT Net  STA ELEVATION vs30 tif.cat
> 1  -3086165 3718184  CI NEE2       271  363       8
> 2  -3143337 3500449  CI  EMS        11  336      14
> 3  -3155773 3704130  CI  DAN       428  304       4
> 4  -3173788 3722206  CI  GRP       978  509       4
> 5  -3188256 3548775  EN  SIM       -64  264      NA
> 6  -3193879 3549663  EN  RED       -64  322      NA
> 7  -3195312 3547901  CI  RXH       -59  331      NA
> 8  -3214063 3540800  CI  ERR       -56  233       8
> 9  -3219756 3587780  CI NSS2        17  246       4
> 10 -3226717 3558278  CI  SAL        14  473       8
> 11 -3229979 3516218  CI  CRR        66  315       4
> 12 -3238308 3596300  CI  THX       -31  244      12
> 13 -3247148 3667171  CI  GTM       836  306       7
> 14 -3254339 3615978  CI  MGE        68  330       4
> 15 -3257283 3597678  CI  PMD       296  257       3
>
> I am assuming there is no precision error since there are no decimals..
>
> Thanks!
>
> Mehdi Khan
>
> 	[[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
>   

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de/
http://www.springer.com/978-0-387-78170-9 e.pebesma at wwu.de



More information about the R-sig-Geo mailing list