[GRASS-user] Tracing dotted lines from raster (and convert to vector)

Nikos Alexandris nikos.alexandris at felis.uni-freiburg.de
Fri May 23 12:08:32 EDT 2008


On Fri, 2008-05-23 at 17:46 +0200, Nikos Alexandris wrote:
> Dear list,
> 
> I am curious to find out if it is possible to successfully convert the
> "boundaries" of a raster map (contains some administrative boundaries)
> in
> a vector map.
> 
> The problem with this raster map is that the boundaries
> are represented by non-continuous lines (dots).
> ---
> Here is the link to the bad-looking gif files which contain
> administrative boundaries (prefectures in Greece):
> http://www.ypes.gr/kapodistrias/greek/kapo/nomoi.htm
> ---
> 
> Is there a way to get the biggest portion out of it as vector
> lines/boundaries and correct manually as less as possible?
> 
> 
> Thank you,
> Nikos
> 
> P.S. My "quick" attempts so far
> 
> (a) 
> 
> I 've tried using r.zc (edge detection) with no satisfactory results.
> 
> 
> (b) 
> 
> 1. Save gif from http://www.ypes.gr/kapodistrias/images/i_trik.gif
> 
> 2. grass -text # and create an xy location
> 
> 3. r.in.gdal input="/grass_db/kapodistrias/data/i_trik.gif"
> output="trikala"
> 
> 4. d.rast trikala cat=3 # cat=3 is the blue color, that is the
> boundaries of interest.
> 
> 5. r.mapcalc trikala_3="if(trikala == 3, 3, null())"
> 
> 6. r.thin input="trikala_3" output="trikala_3.thinned" iterations=200
> 
> 7. r.to.vect input="trikala_3.thinned" output="trikala_3_thinned"
> feature="line"
> 
> 8. v.clean input="trikala_3_thinned" output="trikala_3_thinned_clean"
> type="line" tool="snap,rmdangle,rmbridge,rmdupl" thresh=16
> 
> Probably only snap help here but anyway I tested several options. snap
> threshold above 20 and below 14 gives few/bad lines.
> 
> If there is a way to connect the "blue dots" in the raster map then I
> suppose it would be more or less easy to grab lines from the raster
> map. 



O.K.,

I feel I am closer to the target.

I used r.grow and then r.thin.

Now it looks much better but I have lots of small-length lines left and
right from the borders.

v.clean tool=rmdangle does halfway the job.

How do I tell GRASS (v.clean?) to remove lines of small lentghs?



More information about the grass-user mailing list