[GRASS5] counting number of vector points in same position?

Markus Neteler neteler at itc.it
Thu Aug 11 09:52:56 EDT 2005

On Wed, Aug 10, 2005 at 01:15:54PM -0500, Daniel Calvelo Aros wrote:
> Hi, Markus.
> If your points have the exact same coordinate, you might v.out.ascii then stg
> like 'awk -F"|" {print $1 " " $2} | sort -n | uniq -c' on the output file,
> then v.in.ascii back. If you have a tolerance radius for "same location", some
> rounding tweaking might be needed.

Hi Daniel,

like this it is amazingly simple:

 v.out.ascii tbe_cases_bite | awk -F"|" '{print $1 " " $2}' | sort -n | uniq -c |\
     awk '{printf "%f|%f|%d\n", $2, $3, $1}' | \
     v.in.ascii out=tbe_cases_bite_numbers cat=0 column="east double, north double, count integer"

Done. Maybe worth a script in GRASS (v.pnt.count or so)? Only an extra test
for 3D points is needed to  be added.

BTW: I have fixed v.in.ascii for LatLong vector points where it bailed out
with an error.



More information about the grass-dev mailing list