[GRASS-user] How one can find the starting and end point of a
line in a vector file or how one can connect two line end to end using
C code
ivan marchesini
ivan.marchesini at gmail.com
Sat Mar 3 04:14:37 EST 2012
don't know if can help but v.to.db give you coordinates of starting and
ending points of vector lines
to connect them I use v.edit
this is my pythin code
startc=grass.read_command("v.to.db", flags="p", map="myline",
type="line", option="start", units="meters" , quiet=True)
startx=float(startc.split("|")[1])
starty=float(startc.split("|")[2])
startz=float(startc.split("|")[3])
endc=grass.read_command("v.to.db", flags="p", map="myline",
type="line", option="end", units="meters")
endx=float(endc.split("|")[1])
endy=float(endc.split("|")[2])
endz=float(endc.split("|")[3])
tmpfile = grass.tempfile()
pfile = open(tmpfile, 'w')
print>> pfile, "L", "2", "1"
print>> pfile, startx, starty, startz
print>> pfile, endx, endy, endz
print>> pfile, "1", i
pfile.close()
grass.run_command("v.edit", input=tmpfile, flags="n", tool="add",
map="mynewline", snap="node", thresh="1")
hope this help
Ivan
Il giorno sab, 03/03/2012 alle 11.24 +0530, SWAPAN GHOSH ha scritto:
> Hello,
>
> Any one can solve me the problem like-" How one can find the starting
> and end point of a line in a vector file or how one can connect two
> line end to end using C code". If there is any change needed in code
> like C or Python Script please suggest me. How I can do it.
>
> Regards,
>
> Swapan
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user
--
Ti prego di cercare di non inviarmi files .dwg, .doc, .xls, .ppt.
Preferisco formati liberi.
Please try to avoid to send me .dwg, .doc, .xls, .ppt files.
I prefer free formats.
http://it.wikipedia.org/wiki/Formato_aperto
http://en.wikipedia.org/wiki/Open_format
Ivan Marchesini
Perugia (Italy)
Socio fondatore GFOSS "Geospatial Free and Open Source Software" http://www.gfoss.it
e-mail: ivan.marchesini at irpi.cnr.it
ivan.marchesini at gmail.com
fax (mailfax): +39 1782092534
jabber: geoivan73 at jabber.org
skype: geoivan73
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.osgeo.org/pipermail/grass-user/attachments/20120303/af4d5b97/attachment.bin
More information about the grass-user
mailing list