Learn R Programming

vec2dtransf (version 1.1.3)

plotGridTransformation: Plot grid transformation

Description

Plots a grid transformed to visualize the effects of the transformation on a given extent

Usage

plotGridTransformation(object, bbox, numberOfPoints)

Arguments

object

Object of the class SimilarityTransformation or AffineTransformation

bbox

An SP bbox object, i.e. a 2x2 matrix with coordinates

numberOfPoints

Number of points to represent the grid, perfect squares are recommended.

Author

German Carrillo

Details

The grid is made out of points over the extent defined by bbox. If numberOfPoints has not an integer square root the grid will contain less points.

The grid is transformed using the transformation parameters and displayed over the source grid to see the effects of the transformation.

The source grid is drawn in red whereas the transformed one is green.

This code is based on "Case Study: Fixing Bad TIGER Line data with R and PostGIS" (See References).

References

UC Davis Soil Resource Laboratory. Case Study: Fixing Bad TIGER Line data with R and PostGIS. <URL: http://casoilresource.lawr.ucdavis.edu/drupal/node/433>

See Also

applyTransformation

Examples

Run this code
# From the sp examples:
x <- c(1,1,1,2,2,2,3,3,3)
y <- c(1,2,3,1,2,3,1,2,3)
xy <- cbind(x,y)
S <- SpatialPoints(xy)

st=SimilarityTransformation(parameters=c(1,0,0.2,-0.2))
plotGridTransformation(st, bbox(S), 25)

Run the code above in your browser using DataLab