[GRASS-dev] Re: [GRASSLIST:962] Re: GRASS and vector lines: how
can I change the direction of digitized lines?
Maciek Sieczka
werchowyna at epf.pl
Wed May 17 17:46:40 EDT 2006
Hi,
v.flip 1.2 attached.
On Tue May 16 01:55:07 CEST 2006 Hamish wrote:
> Maciek wrote:
> > I see. I don't do any maths on coordinates, I only use awk to select
> > particular lines from v.out.ascii output and pipe them into another
> > file, in a given order, so I should be on the safe side here.
> >
> > Is it possible to estimate what treshold should be enough? 0.0001,
> > else???
>
> So the coordinates haven't moved and should line up exactly. Thus
> a tresh of 0.0 should catch them, but as a general rule floating point
> numbers are of finite precision so it is usually better to test if
> (a1-a2 < 1e-15) or so.
>
> But this is mostly academic, anything smaller than a centimeter should
> probably be snapped and your original value of 0.01 should be fine.
OK, thanks. I'll just put thresh=0.0001 then, at all events.
> (unless this is a lat/lon location &/or your units are not meters!)
> This means your module "touches the data" and isn't a fully reversable
> proceedure, which may not be desired.
Do you think I should prevent the script from being run in a latlong
location? Unprojected XY too?
> > >It is easier to read, if instead of
> > >
> > >output=$OUTPUT"_toflip"
> > > you do
> > >output=${OUTPUT}_toflip
> > > or
> > >output="${OUTPUT}_toflip"
> >
> > Is the 1st one error prone or only "not nice"?
> >
> > Is any of the 2 you recommend better? I'll correct my script
> > accordingly.
>
> all work, just cleaner to use. Quoting the whole thing only matters if
> you have special characters in the map name, which are illegal anyway.
> Hopefully then you get an informative GRASS error instead of a cryptic
> bash error.
So I'll try to stick to
output="${OUTPUT}_toflip"
Hopefully I changed them all.
What about such as
foll="-"$1
within the awk code? Should they also be changed to something better?
> > >asis=`cat $TMP.cat_asis`
> > >asis=`echo $asis | sed 's/ /,/g'`
> > >probably hit the limitied size cap for a shell variable? (4096
> > >chars?) Use a tmp file.
> >
> > Hmm, $asis is an input in the line 129:
> >
> > v.extract -t layer=$LAYER input=$INPUT list=$asis output=
> > $OUTPUT"_leaveasis"
> >
> > list= has to be a single, long string of numbers separated with ",".
> > So even if I avoid hitting the 4096 chars limit of a bash variable
> > by doing all in a TMP file, I will finally have to pass it to
> > "v.extract list=" as a one string, which will make it fail if the
> > string is longer than 4096 (is my thinking correct?).
>
> ok. maybe better to use an SQL query then where= cat is not flip_list?
> Don't know how to specify that. v.select doesn't have op=not, maybe
> need v.overlay? If only flipping a few of several thousand lines you
> may have trouble.
> > A possible workaround would be to to convert long, continous sets
> > like eg. 1,2,3,4,5,...,100 into 1-100 and so on to save space. Is
> > there an easy way of doing it?
>
> don't know.
I think I solved the problem, lines 128-137. I took care to handle any
possible combination of "," and "-" lists. Time will show :).
> > Thank you very much for all the hints.
>
> You already had it working, which is the hard part. A lot of this is
> just tricks to make the code simpler & easier to catch errors.
Without your hints it would be harder. Thanks again.
The only thing missing I'd like to add is a datatable copy from the
original file to the flipped one. Should be easy, only it's too late to
do it now.
Also I want to send most of the messages into /dev/null.
Maciek
--------------------
W polskim Internecie s? setki milion?w stron. My przekazujemy Tobie tylko najlepsze z nich!
http://katalog.panoramainternetu.pl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: v.flip_12
Type: application/octet-stream
Size: 5448 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20060517/9d8e17be/v.obj
More information about the grass-dev
mailing list