[GRASS-user] to shorten lines

Dear Users...
I have a vector lines map...
I would like to shorten each line of the map.... the amount of the
shortening could be fixed (10 meters.. may be)
I would like to do this in each part of the line... i.e.:

old lines:
____________

new lines:
__________

any idea about a quick way to solve this problem...???

thanks...

Ivan

--
Ti prego di cercare di non inviarmi files .doc, .xls, .ppt, .dwg.
Preferisco formati liberi.
Please try to avoid to send me .doc, .xls, .ppt, .dwg files.
I prefer free formats.
http://it.wikipedia.org/wiki/Formato_aperto
http://en.wikipedia.org/wiki/Open_format

Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a
06125
Perugia (Italy)
e-mail: marchesini@unipg.it
        ivan.marchesini@gmail.com
tel: +39(0)755853760
fax (university): +39(0)755853756
fax (home): +39(0)5782830887
jabber: geoivan73@jabber.org

ivan marchesini wrote:

Dear Users...
I have a vector lines map...
I would like to shorten each line of the map.... the amount of the
shortening could be fixed (10 meters.. may be)
I would like to do this in each part of the line... i.e.:

old lines:
____________

new lines:
__________

any idea about a quick way to solve this problem...???

thanks...

Ivan

Hi Ivan,

pseudo-code (for a script or so):

- fetch all vector lengths with v.report
- calculate length - desired shortening (nice SQL excercise)
- use v.segment with
    L <segment id> <line cat> <start offset> <end offset>
  to create the segments at then end to be removed
- use v.overlay with NOT

cheers
Markus
--
View this message in context: http://www.nabble.com/to-shorten-lines-tf4045136.html#a11491881
Sent from the Grass - Users mailing list archive at Nabble.com.

Many thanks Markus...
I did this way (for a line only, which has category=163 ... now I will
create a cycle for each line of the map):

with this I obtain the length of the line subtracted of 20 meters:
echo "`v.report map=Reticol layer=1 option=area units=meters | grep 163
| cut -f3 -d'|'`-20" | bc -l

with this I create a segment which is 40 meters shorter than the
previous one (20 meters from each node):
echo "L 1 163 20 3434.21" | v.segment input=Reticolo_050407_LAST
output=prova

but no way to do v.overlay with two lines, so I create a buffer of 1
centimeter around the line:
v.buffer input=prova output=prova_buf type=line layer=1 buffer=0.01
scale=1.0 tolerance=0.01

then I will put all the buffers into a single map (v.patch)
and at the end:
v.overlay to obtain the lines network cutted of 20 meters at each
node...

Grazie...
Ivan

Il giorno dom, 08/07/2007 alle 12.27 -0700, Markus Neteler ha scritto:

ivan marchesini wrote:
>
> Dear Users...
> I have a vector lines map...
> I would like to shorten each line of the map.... the amount of the
> shortening could be fixed (10 meters.. may be)
> I would like to do this in each part of the line... i.e.:
>
> old lines:
> ____________
>
> new lines:
> __________
>
>
> any idea about a quick way to solve this problem...???
>
> thanks...
>
> Ivan
>

Hi Ivan,

pseudo-code (for a script or so):

- fetch all vector lengths with v.report
- calculate length - desired shortening (nice SQL excercise)
- use v.segment with
    L <segment id> <line cat> <start offset> <end offset>
  to create the segments at then end to be removed
- use v.overlay with NOT

cheers
Markus

--
Ti prego di cercare di non inviarmi files .doc, .xls, .ppt, .dwg.
Preferisco formati liberi.
Please try to avoid to send me .doc, .xls, .ppt, .dwg files.
I prefer free formats.
http://it.wikipedia.org/wiki/Formato_aperto
http://en.wikipedia.org/wiki/Open_format

Ivan Marchesini
Department of Civil and Environmental Engineering
University of Perugia
Via G. Duranti 93/a
06125
Perugia (Italy)
e-mail: marchesini@unipg.it
        ivan.marchesini@gmail.com
tel: +39(0)755853760
fax (university): +39(0)755853756
fax (home): +39(0)5782830887
jabber: geoivan73@jabber.org

ivan marchesini <marchesini@unipg.it> writes:

> Many thanks Markus...

> I did this way (for a line only, which has category=163 ... now I
> will create a cycle for each line of the map):

> with this I obtain the length of the line subtracted of 20 meters:
> echo "`v.report map=Reticol layer=1 option=area units=meters | grep
> 163 | cut -f3 -d'|'`-20" | bc -l

        You may find `sed' useful as well, e. g.:

$ v.report map=Reticol layer=1 option=area units=meters \
      | grep 163 \
      | cut -f3 -d'|' \
      | sed -e s/\$/-20/ \
      | bc -q

[...]