What is the cause for the degradation of environment?
Capitalism, corruption, consuming society? - OVERPOPULATION!
Please, save the Planet - kill yourself...

Thursday, March 3, 2011

Georeferencing of the maps with "weird" projections in QGIS

Beginners often have issues with georeferencing of rasters, especially if parallels and meridians .are presented by curves, not straight lines. Approaches described below can be used in other GIS software than QGIS, of course if it is capable for it.

I will demonstrate you the general approaches with one of the most complicated examples: as weird as rear - Bonne projection. The true case from gis-lab.info: one guy had a raster map in this projection and he needed very badly to work with it in MapInfo. The problem was, that it is impossible to define Bonne projection in MapInfo... oops, proprietary software fails...  Imagine yourself in his shoes! The situation is that you must utilise raster map (map is not georeferenced), which  projection is not supported by your GIS. What would you do?

Actually it is simple - you just have to georeference the map and then re-project it to the suitable projection. I will use QGIS - my favourite. QGIS utilise the PROJ.4 library and there is no problem with defining Bonne projection, but there is no Bonne projection in default set of projections, and I have no intentions to define it (of course I can, but I don't need it) - so technically it is the same shit: there is no projection for my map so I'm unable to georeference it the right way.

Firstly you have to choose desired projection for the map. This is just an example, so let it be lat/long WGS84. Yep, the map will be georeferenced in lat/long WGS84, not in Bonne, so all 2 steps will be performed as one. In this case you must enter your ground control points (GCP) in units of the desired projection. In this example I don't need to do this (datum and units of the Bonne projected "map" used are the similar to WGS84 lat/lon). Note that we don't even need to provide software with the information about original CRS of the raster.

Let's begin - open our image in Georeferencer module. Then enter GCPs. Doing this you have to take into account, that software is not psychic - it is unable to understand, that this black curve is actually a parallel and every pixel on it have the same latitude; so you must demonstrate the form of this parallel to the software! It is the most important approach: if a parallel / meridian is not a straight line - put at least 3 GCP on it, to let software know that there is a curve. This means that if just parallels (or meridians) are curves, we have to use at least 6 GCP (3 for one parallel and 3 for another one), and if both parallels and meridians are curves we have to use  at least 9 GCP regardless transformation type we use.

Georeferencing of the "map" which original CRS is Bonne
At the pictures above test Bonne "map" and GCPs are shown. Note that there are 114 GCP points (and yes, I've tried outcomes with more sparse points): in such weird projections you have to add as much GCPs as possible, otherwise the result will be awful even if you will try to georeference raster in its original projection.

Now we have to choose transformation type. In most cases "polynomial 3" will be Ok, but not this time. Look at its result - nasty:

Polynomial_3 Bonne to lat/lon WGS84 transformation result
At the picture above red dots are GCPs at its actual positions in WGS84 lat/lon. Result is unacceptable. We have to choose "Thin Plate Spline" transformation instead of polynomial.

Transformation settings
At the picture below you can see a rough approximation of what is happening during transformation:

Vectors of transformation (rough approximation)
Now it is time to see the result of Thin Plane Spline transformation:

Thin Plate Spline transformation to WGS84 lat/lon

Taking into account quality of the original raster and accuracy of putting GCPs (I haven't done my best) results are excellent! Every GCP are where they must be! There are some distortions of course, but note that distortions occured in places with less density of GCPs. Adding another couple of dozens of GCPs will fix this issue.

In the end you are able to use your "weird" map in "normal" projection, supported by target software.

No comments :

Post a Comment