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

Hamish hamish_nospam at yahoo.com
Tue May 18 07:15:11 EDT 2004


> > 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




More information about the grass-dev mailing list