[GRASS-user] removal of duplicate points

Hi,

I have some "squares" which are stored as polygons. When converting these to
points (v.to.points) I am left with the 5 points (first and last point are
duplicated) that define the corners of the "square".

Is there a vector module (v.edit / v.clean) that could remove duplicate
points? I would like to replace the manual operation with v.digit with
something that can be scripted. Note that there are multiple "squares", so a
simple v.out.ascii | head -4 | v.in.ascii would be a little awkward.

Ideas?

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

What’s wrong with v.out.ascii? Couldn’t you export and then remove duplicate points by checking the coordinates? To avoid checking both X and Y, these could be summed, so a single check would be enough.

giovanni

2008/3/5, Dylan Beaudette <dylan.beaudette@gmail.com>:

Hi,

I have some “squares” which are stored as polygons. When converting these to
points (v.to.points) I am left with the 5 points (first and last point are
duplicated) that define the corners of the “square”.

Is there a vector module (v.edit / v.clean) that could remove duplicate
points? I would like to replace the manual operation with v.digit with
something that can be scripted. Note that there are multiple “squares”, so a
simple v.out.ascii | head -4 | v.in.ascii would be a little awkward.

Ideas?


Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On Wed, 2008-03-05 at 09:58 -0800, Dylan Beaudette wrote:

Hi,

Hi Dylan

I have some "squares" which are stored as polygons. When converting these to
points (v.to.points) I am left with the 5 points (first and last point are
duplicated) that define the corners of the "square".

Is there a vector module (v.edit / v.clean) that could remove duplicate
points? I would like to replace the manual operation with v.digit with
something that can be scripted. Note that there are multiple "squares", so a
simple v.out.ascii | head -4 | v.in.ascii would be a little awkward.

Ideas?

Not really a solution but maybe...

If polygons have first and last points duplicated what happens if they
are converted in polylines?

Duplicate coordinates still there?

If not it could be an easy method to convert boundaries to lines and
continue your task.

maybe a script to remove each fifth line of the ascii?

carlos

On Wed, Mar 5, 2008 at 3:27 PM, Nikos Alexandris
<nikos.alexandris@felis.uni-freiburg.de> wrote:

On Wed, 2008-03-05 at 09:58 -0800, Dylan Beaudette wrote:
> Hi,

Hi Dylan

>
> I have some "squares" which are stored as polygons. When converting these to
> points (v.to.points) I am left with the 5 points (first and last point are
> duplicated) that define the corners of the "square".
>
> Is there a vector module (v.edit / v.clean) that could remove duplicate
> points? I would like to replace the manual operation with v.digit with
> something that can be scripted. Note that there are multiple "squares", so a
> simple v.out.ascii | head -4 | v.in.ascii would be a little awkward.
>
> Ideas?

Not really a solution but maybe...

If polygons have first and last points duplicated what happens if they
are converted in polylines?

Duplicate coordinates still there?

If not it could be an easy method to convert boundaries to lines and
continue your task.

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

--
+-----------------------------------------------------------+
              Carlos Henrique Grohmann - Guano
  Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
Linux User #89721 - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke

Can't stop the signal.

On Wed, 2008-03-05 at 19:27 +0100, Nikos Alexandris wrote:

On Wed, 2008-03-05 at 09:58 -0800, Dylan Beaudette wrote:
> Hi,

> Ideas?

Not really a solution but maybe...

Bad Idea afterall!

On Wednesday 05 March 2008, G. Allegri wrote:

What's wrong with v.out.ascii? Couldn't you export and then remove
duplicate points by checking the coordinates? To avoid checking both X and
Y, these could be summed, so a single check would be enough.

giovanni

I guess v.out.ascii | v.in.ascii isn't so bad afterall. I was hoping for a
more general approach that didn't involve the loss of the associated
attribute table. In this case, I only need a simple ID, so the final
incantation looked something like:

v.to.points -v -i in=blocks_1 out=b1p dmax=75 --o
v.to.points -v -i in=blocks_2 out=b2p dmax=75 --o

# patch them together:
v.patch in=b1p,b2p out=vp --o
v.build vp

# remove duplicate points
# new file does not have an attribute table
v.out.ascii vp | sort -g | uniq | v.in.ascii -t out=veg_points

# add attribute table:
v.db.addtable veg_points

# cleanup
g.remove vect=b1p,b2p,vp

# export to shapefile:
v.out.ogr -e in=veg_points type=point dsn=veg_points.shp

And this got the job done. I wonder how hard it would be to add a similar
functionality to v.edit-- which would preserve the attribute table.

Cheers,

Dylan

2008/3/5, Dylan Beaudette <dylan.beaudette@gmail.com>:
> Hi,
>
> I have some "squares" which are stored as polygons. When converting these
> to
> points (v.to.points) I am left with the 5 points (first and last point
> are duplicated) that define the corners of the "square".
>
> Is there a vector module (v.edit / v.clean) that could remove duplicate
> points? I would like to replace the manual operation with v.digit with
> something that can be scripted. Note that there are multiple "squares",
> so a
> simple v.out.ascii | head -4 | v.in.ascii would be a little awkward.
>
> Ideas?
>
> --
> Dylan Beaudette
> Soil Resource Laboratory
> http://casoilresource.lawr.ucdavis.edu/
> University of California at Davis
> 530.754.7341
> _______________________________________________
> grass-user mailing list
> grass-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

On Wed, 2008-03-05 at 10:50 -0800, Dylan Beaudette wrote:

[...]

And this got the job done. I wonder how hard it would be to add a similar
functionality to v.edit-- which would preserve the attribute table.

What about rmdupl for points based on x,y,z?

On Wednesday 05 March 2008, Nikos Alexandris wrote:

rmdupl

right -- from v.clean . This works, but it would be a good idea at some point
to change the v.clean tool descriptions from referring to "lines" when the
tool equally applies to points.

Thanks!

Dylan

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

to change the v.clean tool descriptions from referring to "lines" when the
tool equally applies to points.

There so many things to learn! :slight_smile:
Thanks Nikos, I didn't know it too.

giovanni

On Wed, 2008-03-05 at 11:44 -0800, Dylan Beaudette wrote:

On Wednesday 05 March 2008, Nikos Alexandris wrote:
> rmdupl

right -- from v.clean . This works, but it would be a good idea at some point
to change the v.clean tool descriptions from referring to "lines" when the
tool equally applies to points.

Wait a sec,

does it really work? I didn't test it.

It was just an idea: if it works on lines why not on points I thought.

Thanks!

Dylan

Thank you,

Nikos

On Wednesday 05 March 2008, Nikos Alexandris wrote:

On Wed, 2008-03-05 at 11:44 -0800, Dylan Beaudette wrote:
> On Wednesday 05 March 2008, Nikos Alexandris wrote:
> > rmdupl
>
> right -- from v.clean . This works, but it would be a good idea at some
> point to change the v.clean tool descriptions from referring to "lines"
> when the tool equally applies to points.

Wait a sec,

does it really work? I didn't test it.

Yes it does work, I just tested it.

Dylan

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341