Georeferencing: Difference between revisions

From GRASS-Wiki
Jump to navigation Jump to search
No edit summary
 
(Clarify some of the outdated content)
 
(18 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Q:''' How can maps be georeferenced in GRASS?
'''Q:''' How can maps be georeferenced in GRASS?


'''A:''' Use modules i.group + i.target + i.points/i.vpoints + i.rectify
'''A:'''
* '''CLI way:''' Use modules {{cmd|i.group}} + {{cmd|i.target}} + {{cmd|i.points}}/{{cmd|i.vpoints}} + {{cmd|i.rectify}}
 
* '''GUI way:''' Use [[wxGUI#Georectifier|wxGUI Georectifier]], see {{cmd|wxGUI.GCP_Manager|desc=GCP Manager}}
 
== Overview ==
 
Have you collected GPS points at key points in the map for your Ground Control Points (GPCs)? (can be a fun afternoon) The more the better.
 
With those you use the georectification tool (from the File menu) to add the GCPs. Click on the image at a point you know the GPS position for, then type in the coordinates.
 
You can also do the same with the old i.points module, and if you want to set the points for raster map from another map you can use the {{cmd|i.vpoints}} module, e.g. click on the known point on the already registered map, then click on the corresponding point on your scanned map. There is also an addon version which attempts to identify GPCs automatically.
 
To avoid unneeded losses it is useful to know the projection of the map before starting, rather than rectify to WGS84 lat/lon then reproject ({{cmd|r.proj}}) back to the original. In the case of a projected scanned map you may want to reproject the GCPs with the m.proj module or PROJ.4's cs2cs instead of sending the raster data on a round trip.
 
== Quick tutorial for GUI Georectifier ==
 
Load the scanned map into GRASS into an xy (i.e. non-projected) location.  You can create this location from within any other by using {{cmd|r.in.gdal}} e.g.
 
r.in.gdal -e input=scanned_map.jpg location=scanned_maps output=scanned_map
 
Start up in the location you want the new map to be rectified INTO (not the xy location where it's from).
 
Open any georeferenced map(s), raster or vector, or some combination of multiple layers in a normal map display to serve as a base map for georectification.
 
Start the georectifier.
* Decide if you are going to georectify vectors or rasters and check the appropriate radio button
* Create a group if you don't already have one. This uses i.group for raster and its own routine for vectors (to create a group folder, etc). All maps that can be georectified with the same ground control points can go into the same group
* Select a reference xy map that you can use to set GCP's
* Start georectifying
 
When georectifying, you click on a GCP in the xy map and click on the corresponding point on the base map. You can also enter coordinates if you want. You can delete any GCP or exclude from computations. You can check the RMS error for all active points. This routine bypasses {{cmd|i.points}} and i.vpoints to create a points file. The points file can be used for rasters or vectors, since georectifying of both is supported.
 
When you are ready to georectify the map, pick the polynomial you want to use (dependent partly on the number of points you have), and press the button. This will use {{cmd|i.rectify}} for rasters and v.transform for vectors. AFAIK, 3rd order polynomial georectification is still broken in i.rectify. But the rest should work well.
 
Check the region before georectifying - choose something suitable for the size and resolution of your georeferenced image.
 
The georectified map(s) are projected into your active location/mapset.
 
Here is an outdated screenshot of the georectifier tool in the Tcl/Tk GUI for GRASS 6:
 
[[Image:Grass63 georect2 small2.jpg]]
 
=== Other methods ===
 
* [[QGIS]] has a georeferencing plugin
* Use gdal_translate to assign GCPs and gdalwarp to rectify the image. See the i.warp script in the [[GRASS AddOns]] page.
 
 
[[Category:FAQ]]

Latest revision as of 15:09, 10 November 2021

Q: How can maps be georeferenced in GRASS?

A:

Overview

Have you collected GPS points at key points in the map for your Ground Control Points (GPCs)? (can be a fun afternoon) The more the better.

With those you use the georectification tool (from the File menu) to add the GCPs. Click on the image at a point you know the GPS position for, then type in the coordinates.

You can also do the same with the old i.points module, and if you want to set the points for raster map from another map you can use the i.vpoints module, e.g. click on the known point on the already registered map, then click on the corresponding point on your scanned map. There is also an addon version which attempts to identify GPCs automatically.

To avoid unneeded losses it is useful to know the projection of the map before starting, rather than rectify to WGS84 lat/lon then reproject (r.proj) back to the original. In the case of a projected scanned map you may want to reproject the GCPs with the m.proj module or PROJ.4's cs2cs instead of sending the raster data on a round trip.

Quick tutorial for GUI Georectifier

Load the scanned map into GRASS into an xy (i.e. non-projected) location. You can create this location from within any other by using r.in.gdal e.g.

r.in.gdal -e input=scanned_map.jpg location=scanned_maps output=scanned_map

Start up in the location you want the new map to be rectified INTO (not the xy location where it's from).

Open any georeferenced map(s), raster or vector, or some combination of multiple layers in a normal map display to serve as a base map for georectification.

Start the georectifier.

  • Decide if you are going to georectify vectors or rasters and check the appropriate radio button
  • Create a group if you don't already have one. This uses i.group for raster and its own routine for vectors (to create a group folder, etc). All maps that can be georectified with the same ground control points can go into the same group
  • Select a reference xy map that you can use to set GCP's
  • Start georectifying

When georectifying, you click on a GCP in the xy map and click on the corresponding point on the base map. You can also enter coordinates if you want. You can delete any GCP or exclude from computations. You can check the RMS error for all active points. This routine bypasses i.points and i.vpoints to create a points file. The points file can be used for rasters or vectors, since georectifying of both is supported.

When you are ready to georectify the map, pick the polynomial you want to use (dependent partly on the number of points you have), and press the button. This will use i.rectify for rasters and v.transform for vectors. AFAIK, 3rd order polynomial georectification is still broken in i.rectify. But the rest should work well.

Check the region before georectifying - choose something suitable for the size and resolution of your georeferenced image.

The georectified map(s) are projected into your active location/mapset.

Here is an outdated screenshot of the georectifier tool in the Tcl/Tk GUI for GRASS 6:

Other methods

  • QGIS has a georeferencing plugin
  • Use gdal_translate to assign GCPs and gdalwarp to rectify the image. See the i.warp script in the GRASS AddOns page.