[R-sig-Geo] Accuracy and limitations of Raster and Vector maps

Edzer Pebesma edzer.pebesma at uni-muenster.de
Mon Aug 31 09:37:10 CEST 2009


I am not sure if I can follow your reasoning. The function
SpatialGridDataFrame tries to form a grid from a set of points. In the
earlier example output you sent, it seemed that the set of points you
had were not exactly on a grid. Look at the following two examples:

> library(sp)
> pts1 = data.frame(x = rnorm(10),y = rnorm(10), z = rnorm(10))
> gridded(pts1) = ~x+y
suggested tolerance minimum: 0.758031516672908
Error in points2grid(points, tolerance, round, fuzz.tol) :
  dimension 1 : coordinate intervals are not constant
> pts2 = data.frame(expand.grid(x=1:10,y=1:10),z=rnorm(100))
> gridded(pts2) = ~x+y
> points2grid(pts2)
                   x  y
cellcentre.offset  1  1
cellsize           1  1
cells.dim         10 10

It is clear that for pts1 it is complete nonsense to try to find a grid
structure, as it is not there. For the second one it is there by
construction -- expand.grid does this.

For cases where data are almost on a grid, but not exactly (often
because of rounding of coordinates that are not round numbers but
written to ascii text), points2grid tries to find a useful grid
topology, but may fail. You can enlarge its tolerance to help it find
one, but no success guaranteed.

If you want to compare overlays, you better make sure you have a real
and identical grid in both environments (R and ArcGIS), and do the
overlay in both. In R, this is done with the overlay method.
--
Edzer

Mehdi Khan wrote:
> Hello everyone, I am trying to investigate what the shortcomings may be of
> using vectors/ rasters in determining attribute data from one program to
> another.  My project has entailed overlaying points on different maps
> (vector as well as raster based) and then determining attribute data from
> each one and comparing them against one another.
> 
> What would the limitations be in this process?  From what I understand, one
> of the limitations is that there are tolerance limits within the program
> which are used to assign points from one pixel to another.  I don't fully
> understand this concept-- why would one need a tolerance when determining if
> a point is within a square or outside of it?
> 
> thank you all for your help!
> 
> 	[[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