[GRASS-dev] [GRASS GIS] #1470: v.out.ascii with sql where option exports only centroids and not areas

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone:
Component: Vector | Version: svn-trunk
Keywords: | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
It's not possible to export areas selected by SQL WHERE clause.
Example from NC data set. Let's export only lake with CAT=5109:
{{{
v.out.ascii input=lakes@PERMANENT layer=1 output=vbuffer_fail_on_area3
where=cat=5109 format=standard
}}}
Output vector part:
{{{
C 1 1
  627457.82440791 231495.92575519
  1 5109
}}}

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

  * keywords: => v.out.ascii
  * milestone: => 6.4.3

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mlennert):

Replying to [ticket:1470 marisn]:
> It's not possible to export areas selected by SQL WHERE clause.
> Example from NC data set. Let's export only lake with CAT=5109:
{{{
> v.out.ascii input=lakes@PERMANENT layer=1 output=vbuffer_fail_on_area3
where=cat=5109 format=standard
}}}
> Output vector part:
{{{
> C 1 1
> 627457.82440791 231495.92575519
> 1 5109
}}}

This is logicial in the sens that only the centroid has a cat=5109. No
boundary has this cat. So this would mean implementing a specific
algorithm to check which boundary needs to be exported together with this
centroid.

As a workaround: v.extract and then v.out.ascii. Maybe this can be coded
in a script ?

Moritz

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Old description:

It's not possible to export areas selected by SQL WHERE clause.
Example from NC data set. Let's export only lake with CAT=5109:
{{{
v.out.ascii input=lakes@PERMANENT layer=1 output=vbuffer_fail_on_area3
where=cat=5109 format=standard
}}}
Output vector part:
{{{
C 1 1
627457.82440791 231495.92575519
1 5109
}}}

New description:

It's not possible to export areas selected by SQL WHERE clause.
Example from NC data set. Let's export only lake with CAT=5109:
{{{ood
v.out.ascii input=lakes@PERMANENT layer=1 output=vbuffer_fail_on_area3
where=cat=5109 format=standard
}}}
Output vector part:
{{{
C 1 1
  627457.82440791 231495.92575519
  1 5109
}}}

--

Comment(by martinl):

Replying to [comment:2 mlennert]:
> Replying to [ticket:1470 marisn]:
> This is logicial in the sens that only the centroid has a cat=5109. No
boundary has this cat. So this would mean implementing a specific
algorithm to check which boundary needs to be exported together with this
centroid.

Basically it could be possible. Currently `v.out.ascii` opens vector map
on level 1 (without topology). This would require level 2 (topology). I
can imagine special flag which writes out also areas (boundaries and
centroids), not only centroids. The problem is that boundaries of adjacent
areas will printed twice. I am not sure whether it's a good idea to extend
functionality of this module in this direction. Any opinion?

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Description changed by martinl:

Old description:

It's not possible to export areas selected by SQL WHERE clause.
Example from NC data set. Let's export only lake with CAT=5109:
{{{ood
v.out.ascii input=lakes@PERMANENT layer=1 output=vbuffer_fail_on_area3
where=cat=5109 format=standard
}}}
Output vector part:
{{{
C 1 1
627457.82440791 231495.92575519
1 5109
}}}

New description:

It's not possible to export areas selected by SQL WHERE clause.
Example from NC data set. Let's export only lake with CAT=5109:
{{{
v.out.ascii input=lakes@PERMANENT layer=1 output=vbuffer_fail_on_area3
where=cat=5109 format=standard
}}}
Output vector part:
{{{
C 1 1
  627457.82440791 231495.92575519
  1 5109
}}}

--

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [comment:3 martinl]:
> Replying to [comment:2 mlennert]:
> > Replying to [ticket:1470 marisn]:
> > This is logicial in the sens that only the centroid has a cat=5109. No
boundary has this cat. So this would mean implementing a specific
algorithm to check which boundary needs to be exported together with this
centroid.
>
> Basically it could be possible. Currently `v.out.ascii` opens vector map
on level 1 (without topology). This would require level 2 (topology). I
can imagine special flag which writes out also areas (boundaries and
centroids), not only centroids. The problem is that boundaries of adjacent
areas will printed twice. I am not sure whether it's a good idea to extend
functionality of this module in this direction. Any opinion?

There is enough code in GRASS (other modules, libs) that takes care of
such cases, boundaries would not be written twice. Basically a boundary
would be written out if the centroid of any of its two areas has a cat
value which is in the list. I would like to see that option/functionality
in `v.out.ascii` because most of the time the vector objects a user works
with are points, lines, areas. Modules/libs then take care of appropriate
handling of boundaries and centroids.

my2c

Markus M

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Replying to [comment:5 mmetz]:
> There is enough code in GRASS (other modules, libs) that takes care of
such cases, boundaries would not be written twice. Basically a boundary
would be written out if the centroid of any of its two areas has a cat
value which is in the list. I would like to see that option/functionality
in `v.out.ascii` because most of the time the vector objects a user works
with are points, lines, areas. Modules/libs then take care of appropriate
handling of boundaries and centroids.

right, please try out r48886 and r48887 (trunk).

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:6&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [comment:6 martinl]:
> Replying to [comment:5 mmetz]:
> > There is enough code in GRASS (other modules, libs) that takes care of
such cases, boundaries would not be written twice. Basically a boundary
would be written out if the centroid of any of its two areas has a cat
value which is in the list. I would like to see that option/functionality
in `v.out.ascii` because most of the time the vector objects a user works
with are points, lines, areas. Modules/libs then take care of appropriate
handling of boundaries and centroids.
>
> right, please try out r48886 and r48887 (trunk).

I have modified r48886 to avoid segfaults and r48887 to open vectors with
topology only when needed (partially restoring original behaviour to
support fast export of massive point vectors).

Markus M

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:7&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Replying to [comment:7 mmetz]:
> I have modified r48886 to avoid segfaults and r48887 to open vectors
with topology only when

ops, thanks. Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:8&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by martinl):

Replying to [comment:8 martinl]:
> Replying to [comment:7 mmetz]:
> > I have modified r48886 to avoid segfaults and r48887 to open vectors
with topology only when

small fix in r48894

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:9&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------

Comment(by mmetz):

Replying to [comment:9 martinl]:
> Replying to [comment:8 martinl]:
> > Replying to [comment:7 mmetz]:
> > > I have modified r48886 to avoid segfaults and r48887 to open vectors
with topology only when
>
> small fix in r48894

ops, thanks;) Markus M

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:10&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: grass-dev@…
     Type: defect | Status: new
Priority: blocker | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

  * priority: normal => blocker

Comment:

Backported to devbr6 for testing (r48914)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:11&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
-------------------------+--------------------------------------------------
Reporter: marisn | Owner: martinl
     Type: defect | Status: assigned
Priority: blocker | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Keywords: v.out.ascii | Platform: Unspecified
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
Changes (by martinl):

* cc: grass-dev@… (added)
  * owner: grass-dev@… => martinl
  * status: new => assigned

Comment:

backported also to relbr64 (-> GRASS 6.4.3), testing welcomed (r50981)

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:12&gt;
GRASS GIS <http://grass.osgeo.org>

#1470: v.out.ascii with sql where option exports only centroids and not areas
--------------------------+-------------------------------------------------
  Reporter: marisn | Owner: martinl
      Type: defect | Status: closed
  Priority: blocker | Milestone: 6.4.3
Component: Vector | Version: svn-trunk
Resolution: fixed | Keywords: v.out.ascii
  Platform: Unspecified | Cpu: Unspecified
--------------------------+-------------------------------------------------
Changes (by neteler):

  * status: assigned => closed
  * resolution: => fixed

Comment:

The export is now:
{{{
v.out.ascii input=lakes output=vbuffer_area where=cat=5109 format=standard
grep 'B \|C ' vbuffer_area
B 93
B 152
B 162
B 3
B 3
C 1 1
}}}

Reimport:
{{{
v.in.ascii vbuffer_area out=myarea format=standard
Building topology for vector map <myarea>...
Registering primitives...
6 primitives registered
414 vertices registered
Building areas...
  100%
1 areas built
1 isles built
Attaching islands...
  100%
Attaching centroids...
  100%
Number of nodes: 6
Number of primitives: 6
Number of points: 0
Number of lines: 0
Number of boundaries: 5
Number of centroids: 1
Number of areas: 1
Number of isles: 1
v.in.ascii complete.
}}}

Looks correct. Closing since it appears to be fixed. Reopen if needed.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/1470#comment:13&gt;
GRASS GIS <http://grass.osgeo.org>