Home » Software » PostGIS: Spatially enabled Relational Database Sytem » Affine Transformation Operations in PostGIS » Case Study: Fixing Bad TIGER Line data with R and PostGIS

# Case Study: Fixing Bad TIGER Line data with R and PostGIS

Jun 3, 2007 metroadmin

- transform using GRASS and a set of control points with v.transform. This is the natural choice if the data is already in GRASS.
- Using the same control points, compute the transformation matrix in R, then apply in PostGIS with the Affine() function. This is the ideal approach for our scenario. Note that the format of the 'fitted' transformation matrix returned by R is in a slightly different format:

Computing the transformation matrix can be done with a simple regression between 'good' and 'bad' coordinates in R. Note that this approach was suggested by Prof. Brian Ripley on the R-help mailing list.

**Compute the Affine Transformation Matrix in R**

**Check Affine Transform Results in PostGIS**

**Perform Affine Transformation in PostGIS**

**Regression Diagnostics**

### Attachment:

### Links:

Comparision with output from v.transform

Higher Order Transformations

Higher Order Transformations

## Software

- General Purpose Programming with Scripting Languages
- LaTeX Tips and Tricks
- PostGIS: Spatially enabled Relational Database Sytem
- PROJ: forward and reverse geographic projections
- GDAL and OGR: geodata conversion and re-projection tools
- R: advanced statistical package
- GRASS GIS: raster, vector, and imagery analysis
- Generic Mapping Tools: high quality map production