Skip to main content

For walking a graph you have all the v.net family. To extract the vertices coordinates of lines or polygons (and other columns) one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates(see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.asciiv.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

For walking a graph you have all the v.net family. To extract the vertices coordinates of lines or polygons (and other columns) one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates(see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

For walking a graph you have all the v.net family. To extract the vertices coordinates of lines or polygons (and other columns) one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates(see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

added 54 characters in body
Source Link
gene
  • 55.4k
  • 3
  • 113
  • 191

For vectorwalking a graph you have all the v.net family. To extract the vertices coordinates of lines or polygons (and other columns) one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates of vertices, and other columns, if you want, (see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

For vector lines or polygons one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates of vertices, and other columns, if you want, (see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

For walking a graph you have all the v.net family. To extract the vertices coordinates of lines or polygons (and other columns) one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates(see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

added 33 characters in body
Source Link
gene
  • 55.4k
  • 3
  • 113
  • 191

For vector lines or polygons one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates of vertices, and other columns, if you want, (see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

For vector lines or polygons one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates of vertices (see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

For vector lines or polygons one solution is, as always, through v.out.ascii that gives you the xy(z) coordinates of vertices, and other columns, if you want, (see 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)

test = grass.read_command("v.out.ascii", input="yourvector", format="standard")

The result is given in v.out.ascii. In my case, for example, the variable test is:

ORGANIZATION: 
DIGIT DATE: 
MAP NAME:  
MAP DATE:     Sun Jun 24 10:16:35 2012
MAP SCALE:    1
OTHER INFO:  
ZONE:         0
MAP THRESH:   0.000000
VERTI:
L  7 1
206643.21517601 125181.18058576
201007.33432923 121517.8555206
208615.77587567 118699.91687157
199034.77765775 115036.59058769
200725.54321492 111936.8560102
192835.30987687 107428.14794157
192835.30987687 107428.14794157
1 1

It is a (poly)line with one element and 7 vertices (L 7 1) and test is a Python string so

result = test.split("\n") 

and you have a list with the lines of test. If you use regular expressions:

for line in result:
if re.findall(r'^.[0-9]+\.',line):
    print line

 206643.21517601 125181.18058576
 201007.33432923 121517.8555206
 208615.77587567 118699.91687157
 199034.77765775 115036.59058769
 200725.54321492 111936.8560102
 192835.30987687 107428.14794157
 192835.30987687 107428.14794157

and

coords = []    
for line in result:
   if re.findall(r'^.[0-9]+\.',line): 
       coords.append(line.strip().split(" "))

gives you the solution

[['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157'], ['206643.21517601', '125181.18058576'], ['201007.33432923', '121517.8555206'], ['208615.77587567', '118699.91687157'], ['199034.77765775', '115036.59058769'], ['200725.54321492', '111936.8560102'], ['192835.30987687', '107428.14794157'], ['192835.30987687', '107428.14794157']]

After that, you can create a new point vector file with the xy values and 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

added 31 characters in body
Source Link
gene
  • 55.4k
  • 3
  • 113
  • 191
Loading
Source Link
gene
  • 55.4k
  • 3
  • 113
  • 191
Loading