s.voronoi: removing duplicate lines

Darrell McCauley mccauley at ecn.purdue.edu
Wed Apr 8 16:34:58 EDT 1992


How do you remove duplicate lines from vector files? 
I'm talking about lines that should be *exactly* the same.
Does v.spag work for this? Should this be something to
consider adding to v.support (I don't think that it has this)?

The problem is the following: I have vertices of polygons
for a vector map (a Voronoi diagram). All boundaries (except for 
borders) are shared by two polygons. I'm trying to write a vector 
map. I can easily:
 1. write each line separately (thus producing many duplicates), or
 2. write each polygon as a line (producing spaghetti code or missing
    nodes AND duplicates lines).
The correct way of doing this (I guess) would be do store all lines
(either in a large array or in a tmp file), compare each of them,
removing duplicates as I find them (perhaps a unique sort), then write
each as an area edge.

Comments? 

BTW, the sun C libs include a quicker-sort (qsort)... can this be
safely used when thinking of portability (for all platforms on which
grass is expected to run)?

--Darrell



More information about the grass-dev mailing list