[GRASS-user] Re: grass-user Digest, Vol 24, Issue 10

Richard Chirgwin rchirgwin at ozemail.com.au
Wed Apr 9 17:59:19 EDT 2008


Edmondo,
> Dear All,
> I've imported a .PNG file with r.in.gdal (i.e. map.png) in order to make a
> georeferencing file. The importing procedure returned 3 files: map.red,
> map.green, map.blue. I don't know how continue to reach my goal.
>
> Thanks in advance
>
> Edmondo
When I was a raw newbie, georeferencing caused me no end of pain! So 
I'll give you the long answer. Note: there is a single-tool interface to 
georeferencing, but I find it's easiest and most reliable to follow the 
individual tool steps (i.group, i.target, i.points, i.rectify).

1) "Target" map
You must have something to georeference your input map against. So if I 
was looking at an image of Sydney, it's best if I already have a raster 
map of Sydney in my target location (the place I want the georeferenced 
input to end up in). If you have a vector map in the target location, 
you'll have to do more typing!

2) Import image to *new* location
 From your message, I guess you've already done this!

3) Create a group
By creating a group containing your red, green and blue layers, you will 
ensure that rectification happens to all three. For this, you use the 
i.group command:
i.group group=<groupname> input=<red map name>,<green map name>,<blue 
map name>

4) "Target" the group
In this step, you're telling Grass-GIS "These maps will end up being 
georeferenced against this location". So you might have:
Import_Location > PERMANENT
to be georeferenced to:
Target_Location > PERMANENT

Running in your Import_Location, PERMANENT mapset, you run i.group:
i.group group=<groupname> location=Target_Location mapset=PERMANENT

5) Capture georeferencing points.
In an X monitor, you will display your imported image (one layer only - 
because red, green and blue are in the same group, they will all be 
rectified together later). If you have a raster image of the target 
location in Target_Location, you can display this next to your imported 
image, and just use mouse clicks to capture ground control points. If 
you don't have a comparable raster image, you'll have to use 
latitude-longitude of your ground control points.
What you're doing in this step is telling Grass-GIS "This location in 
the imported map is equal to these co-ordinates in the real world".
First, open the X monitor:
d.mon start=x0
Next, start i.points
i.points group=<groupname>

If you have a "target" raster:
The window will ask you to choose the map to display on the left (this 
is your imported map). If you have a reference map available in 
Target_Location, select the PLOT RASTER button at the bottom and click 
on the right-hand side of the X monitor. This will allow you to select a 
map i the target location. Then, if you click on a point on the 
left-hand side, and click on a corresponding point on the right-hand 
side, Grass-GIS will capture coordinates for you.

If you don't have a "target" raster:
You will need to have co-ordinates for known points in your imported 
map. Click on a point in the map, and type the co-ordinates into the 
terminal window that opens.

It works best if you select points at the corners of your imported map. 
If you can identify co-ordinates at the four corners, this should be 
sufficient.

6) Rectify

Now, you just need to run i.rectify:
i.rectify -a group=<groupname> extension=<string> order=<value>

The -a flag tells Grass-GIS to rectify all maps in the group (red, green 
and blue). The extension is necessary, but can be anything you like (I 
usually use _rectified as the extension). This will be added to the 
existing map names in the target set. Order is the polynomial order you 
use for the calculation - if you only have four points at the corners, 
then order=1. So I rectify will look something like this:
i.rectify -a group=<groupname> extention=_rectified order=1

7) Check
Open Grass-GIS, enter your target location, and display the rectified 
version of your map to see if it worked.

Hope this makes it all clear!
Richard Chirgwin


More information about the grass-user mailing list