[GRASSLIST:269] Re: raster to vector conversion

Matej Cepl cepl at surfbest.net
Fri May 30 15:44:30 EDT 2003


On Fri, May 30, 2003 at 11:38:22AM -0500, Kirk R. Wythers wrote:
>> For transformation of plain bitmap to vector (without 
>> georeferencing etc.) 
>
>What if the image is georeferenced?

Then you have to make coordinate transformation of xy data. Make 
brief abstract of [Neteler, Mitasova, 2002, p. 128] the procedure 
should be probably as follows:

1) Stay in the location with the projection desired (i.e., in 
   your case probably just stay in the original location)
2) Import DXF file (autotrace can produce .dxf files) as xy 
   coordinated
      
      v.in.dxf -a dxf=vmap.dxf prefix=vmap

   It will generate a series of ASCII vector maps in 
   $LOCATION/dig_ascii
   
   ls dig_ascii/vmap*
   
3) Import one ASCII vector map as binary

   v.in.ascii in=vmap.lines out=vmap_xy

4) Find four well visible points in the map, which may be used as 
   control points. Switch to the imported map region (xy):

   g.region -p vector=vmap_xy
   d.erase
   d.vect vmap_xy

5) Using d.what find xy coordinates of the control points:

   d.what.vect map=vmap_xy

   write them to some file (e.g., ./control_points), just one 
   line for easting and northing.

6) Switch to region of the original raster map (named for example 
   vmap.r):

   g.region rast=vmap.r
   d.erase
   d.rast vmap.r

7) Using d.what.rest get georeferenced coordinates of the control 
   points and write them to the ./control_points file to the 
   other columns:

   d.what.rast map=vmap.r

   The resulting ./control_points file should look like this:

   838.8    244.2 1661701.3   5108172.4
   796.2    192.6 1661643.2   5108204.3
   796.2    91.6  1661543.7   5108181.8
   1110.6   379.0 1661864.4   51O8076.6

8) Make the transofrmation with v.transform (see its manpage for 
   further info) and build its topology:

   v.transform input=vmap.lines output=vmap_trans \
      pointsfile=./control_points
   v.in.ascii input=vmap_trans output=vmap_trans
   v.support vmap_trans

   v.transform prints out RMS (root mean square) error for each 
   ground control point, if these are too big ([Neteler, 
   Mitasova, 2002, p. 130] gives 1.2 to 2.4 meters as an 
   acceptable error for map 1:24,000), you have to find another 
   control points and redo the transformation with new 
   ./control_points file.

9) To verify transformation display two maps in the new maps' 
   region:

   g.region vect=vmap_trans
   d.erase
   d.rast vmap.r
   d.vect vmap_trans col=red

   The result should match.

BTW, PLEASE reply to the list when asking further information not 
to my personal address. It is selfish (because no one can find an 
answer in the list's archives) and stupid (because noone can 
control my answer) to do otherwise.

   Have a nice day,

      Matej

-- 
Matej Cepl, http://www.ceplovi.cz/matej
GPG Finger: 89EF 4BC6 288A BF43 1BAB  25C3 E09F EF25 D964 84AC
138 Highland Ave. #10, Somerville, Ma 02143, (617) 623-1488
 
Microwave oven?  Whaddya mean, it's a microwave oven?  I've been
watching Channel 4 on the thing for two weeks.




More information about the grass-user mailing list