Dear All:
Mauricio and others were sitting on figuring out the "holy grail" of how
to automatically vectorise lines and polygons from georeferenced print
maps.
Schuyler and I sat on this and figured out this series of commands using
the hoary GRASS GIS
http://grass.osgeo.org/, see the before and after
images attached.
1. r.mapcalc to threshold
2. r.thin to thin out lines
3. r.to.vect to convert raster to linework
4. v.type to convert lines to boundaries
5. v.clean to tidy up by tweaking variables
6. v.centroids to add centroids to areas
GRASS can be used on the command line or with the desktop program QGIS
http://qgis.org with the GRASS Toolbox plug-ins. Here are the full
commands:
> g.region rast=original
> r.mapcalc 'mask=if(original==0,0,1)'
> r.mask mask
> r.mapcalc 'bw=if(original<160,255,0)'
> r.thin in=bw out=thinned
> r.to.vect in=thinned out=lines feature=line
> v.type in=lines out=bounds type=line,boundary
> v.clean in=bounds out=areas tool=snap,bpol,rmdupl,prune,rmline,rmsa
thresh=0.000005,0,0,0.0000025,0,0
> v.centroids --o in=areas out=polys
One can then use v.out.ogr to export a shape file of the new vector layer.
Best,
S.K.
--
Shekhar Krishnan
Topomancy LLC
http://shekhar.cc
http://topomancy.com