Scanning maps and GRASS

Steve Dzurenko steve at ocean.oce.uri.EDU
Mon Nov 6 07:00:00 EST 1995



Casey,

I have done this successfully with NOAA charts.  The steps are
roughly as follows:

1.  Scan your map.  Mine was bought pre-scanned on CDROM.
So you must have some kind of access to a scanner or have
someone scan it for you.  The scanned image will be in some
kind of image format, I have worked with PCX and tiff 
scanned images.  

2.  Convert the scanned image to GRASS raster.  I did this 
using pbmplus tools, distributed with GRASS source as part
of the src.related.  I converted the PCX image to tiff and
then imported the tiff file to GRASS raster using r.in.tiff.
I believe you can go straight from PCX to raw raster, but 
you would have to create your own GRASS header for each raw
raster, and a colr file.  I decided to let r.in.tiff do that
for me.

3.  r.mapcalc the image together.  You may or may not have
to do this, depending on the size of you map and the size 
of your scanner.  My scanned NOAA chart was broken up into
about 150 separate images.  So I wrote a csh script to do
step 2 for each separate image.  In the same script, I then 
r.mapcalced all images together to produce the full chart.
This part is a little funky because each image "tile" had
a separate GRASS region with east=0, west=480, south=0,
north=640.  I won't go into details, primarily because I
can't remember off-hand what I had to do, but I had to 
create a loop and keep track of what tile I was on and what
the region was so the end region worked out.  If you need
to do this, I could post the script I created.

The script to do step 2 and 3 took on the order of 2 hours
to run on my SGI Indigo2.  I let it run at the end of the
day.  The resulting GRASS raster layer had a resolution
of 3 meters and was 6Mb compressed.

4.  Rectify the image.  The GRASS raster resulting at the 
end of step 3 is in x-y coordinates.  I am not sure how one
is supposed to accomplish this step, but what I did is 
put the xy raster in a separate mapset I created called
imagery, in the LOCATION where I wanted the finished,
rectified image to end up.  I put the xy raster in the cell
element of MAPSET imagery.  Likewise, I put the header and
colr file for the xy raster in cellhd and colr.  

I then started GRASS using MAPSET imagery.  
run i.group to create a new imagery group which your image
to rectify will be associated with.  I had one image, it
is called chart13223, so I called the image group chart13223
also.
run i.target to identify the target LOCATION and MAPSET for
the rectified GRASS raster.  I don't believe you have to 
create a separate MAPSET for your xy rasters, but I did
because it seemed a logical way to organize the imagery data 
and I will eventually be doing this with many other NOAA
charts.
run i.points to register a number of control points on your
image.  You will need some method of picking of very well 
positioned points on your map.  If there is a lat/lon grid
on the map, like there was on mine, this job is very easy.
If not, you must identify a number of points and get good
positions for them.d
run i.rectify to rectify the image.  The rectified image 
will automatically be placed in you target LOCATION and 
MAPSET.  You should be good to go now.  I compared the 
rectified chart image with my existing coastline data and
they were right on!

If you have any further questions, please ask.

-Stephen Dzurenko
 Ocean Mapping Division
 Ocean Technology Center 
 Graduate School of Oceanography
 University of Rhode Island

 ph: 401 792-6853
 fx: 401 792-6849
 e-mail: steve at ocean.oce.uri.edu





More information about the grass-user mailing list