[GRASS5] [5.7] v.out.ascii to stdout

5.7's v.out.ascii produces no output when output= isn't specified.
(i.e. -> stdout)

line 35 of grass51/vector/v.out.ascii/b2a.c
   if ( pnt && !(type & GV_POINT) ) continue;

That should that be ..!(type && GV_POINT) right?

I'd guess so, but the bitwise stuff isn't my forte.

thanks,
Hamish

On Thursday 13 May 2004 03:06, you wrote:

5.7's v.out.ascii produces no output when output= isn't specified.
(i.e. -> stdout)

line 35 of grass51/vector/v.out.ascii/b2a.c
   if ( pnt && !(type & GV_POINT) ) continue;

That should that be ..!(type && GV_POINT) right?

I'd guess so, but the bitwise stuff isn't my forte.

That's correct, I think, did you get a wrong output?
Maybe better !(type & (GV_POINT|GV_CENTROID) ) ?

Radim

> 5.7's v.out.ascii produces no output when output= isn't specified.
> (i.e. -> stdout)
>
> line 35 of grass51/vector/v.out.ascii/b2a.c
> if ( pnt && !(type & GV_POINT) ) continue;
>
>
> That should that be ..!(type && GV_POINT) right?
>
> I'd guess so, but the bitwise stuff isn't my forte.

That's correct, I think, did you get a wrong output?
Maybe better !(type & (GV_POINT|GV_CENTROID) ) ?

Without the change I get no output:

G57: > v.out.ascii in=land
writing to stdout
G57: >

same for maps with only areas or maps with only lines.

Changing & to && I get:

G57: > v.out.ascii in=land | wc -l
writing to stdout
2016589.9107143|5433474.7978984
2009912.00812986|5447994.01089015
2008323.09308861|5442074.97924335
2022526.22078371|5439394.32499626
2010007.76416546|5445751.81902361
2020753.91103019|5438573.57601026
2021207.84465802|5440556.75323897
2013825.65294696|5451055.89008002
2017778.35756621|5452245.97672999
2017641.3474592|5451595.88459047
[...]
G57: > v.out.ascii in=land | wc -l
4750

Changing to "if ( pnt && !(type & (GV_POINT|GV_CENTROID) ) ) {"
I get:

G57: > v.out.ascii in=land
writing to stdout
2017617.60219158|5435424.46544081|1
2011453.44388222|5448739.02879616|2
2009179.7786609|5442232.57413524|3
2022819.40801294|5438327.87323714|4
2009919.20095461|5445111.52844015|5
2020407.25907573|5438021.51196787|6
2021131.5452502|5440454.40233992|7
2013591.90459184|5450931.40066914|8
2017416.9871779|5452080.59517219|9
2017965.18476999|5451918.73312143|10
[...]
G57: > v.out.ascii in=land | wc -l
2308

G57: > v.build land
Building topology ...
4749 primitives registered
2307 areas built
2306 isles built
Topology was built.
Number of nodes : 4748
Number of primitives: 4749
Number of points : 0
Number of lines : 0
Number of boundaries: 2442
Number of centroids : 2307
Number of areas : 2307
Number of isles : 2306

not sure which is "better" or expected output. Usually I'd think nodes
were more useful to have exact positions for than centroids..

Hamish

On Tuesday 18 May 2004 13:15, Hamish wrote:

> That's correct, I think, did you get a wrong output?
> Maybe better !(type & (GV_POINT|GV_CENTROID) ) ?

Without the change I get no output:

G57: > v.out.ascii in=land
writing to stdout
G57: >

same for maps with only areas or maps with only lines.

Correct, no points.

Changing & to && I get:

G57: > v.out.ascii in=land | wc -l
writing to stdout
2016589.9107143|5433474.7978984
[...]
G57: > v.out.ascii in=land | wc -l
4750

Wrong, 'type && GV_POINT' is always true, writes out first point of lines.

Changing to "if ( pnt && !(type & (GV_POINT|GV_CENTROID) ) ) {"
I get:

G57: > v.out.ascii in=land
writing to stdout
2017617.60219158|5435424.46544081|1
[...]
G57: > v.out.ascii in=land | wc -l
2308

OK, writes centroids (in this case).

not sure which is "better" or expected output. Usually I'd think nodes
were more useful to have exact positions for than centroids..

This I don't understand.

Radim

On Wed, 26 May 2004 15:58:44 +0200
Radim Blazek <blazek@itc.it> wrote:

On Tuesday 18 May 2004 13:15, Hamish wrote:
> > That's correct, I think, did you get a wrong output?
> > Maybe better !(type & (GV_POINT|GV_CENTROID) ) ?
>
> Without the change I get no output:
>
> G57: > v.out.ascii in=land
> writing to stdout
> G57: >
>
> same for maps with only areas or maps with only lines.

Correct, no points.

Perhaps we should add a "WARNING: no point data" message in that case?

> Changing & to && I get:
>
> G57: > v.out.ascii in=land | wc -l
> writing to stdout
> 2016589.9107143|5433474.7978984
> [...]
> G57: > v.out.ascii in=land | wc -l
> 4750

Wrong, 'type && GV_POINT' is always true, writes out first point of
lines.

> Changing to "if ( pnt && !(type & (GV_POINT|GV_CENTROID) ) ) {"
> I get:
>
> G57: > v.out.ascii in=land
> writing to stdout
> 2017617.60219158|5435424.46544081|1
> [...]
> G57: > v.out.ascii in=land | wc -l
> 2308

OK, writes centroids (in this case).

> not sure which is "better" or expected output. Usually I'd think
> nodes were more useful to have exact positions for than centroids..

This I don't understand.

Perhaps we should think about adding a type=point,area,centroid,line,etc
option to v.out.ascii?

This isn't something I need right now, but it might be useful to
someone..

Hamish