Can anybody assist in the simplest form of code to call on command line to "export topology" (which is level 2 information in GRASS) as separate spatial data, as explained below?
I have imported cad lines via dxf file containing only lines (a network of pipelines connected in a geographic pattern) into GRASS GIS via command line. This data I convert to polylines via GRASS v.build.polylines
combining individual line segments into polylines in between the connection points. (All "joined" lines that do not intersect with other lines are "concatenated" into a single polyline, thus the network only consists of connected polylines)
The resultant vector map has three "layers" (in GRASS only first "layer", other two as "level") reported by QGis GRASS Plugin
(seemingly only in QGis GUI?)
The "names" assigned to the "level" or "layer" is given by the QGis GRASS Plugin
as 1:"Line", 2:"line_topo" and 3:"point_topo" and more elaborately,
- Line -> polylines as expected <<<<<<<<<< termed "map" in GRASS
- line_topo -> the same polylines, but with node connection table <<<<<<<< @ level 2 in GRASS without "direct" access
- point_topo -> the beginning and end points (connection points) of all polylines, with table indicating the lines associated with the specific node <<<<<<<<<<<<< also @ level 2 in GRASS and also without "direct" access
("direct" access in this context is : a v.?? or similar command -> thus that can "access"/"extract"/"manipulate"/"export"/"or in any form whatsoever make it data that can be worked on outside of GRASS")
These "layers" are reported differently by GRASS (mapname = PipePolyLines):
v.info -t map=PipePolyLines
Cleaning up temporary files ...
Starting GRASS ...
Welcome to GRASS 6.4.3 (2013)
nodes=23274 <<<<<< topology of polyline "connection nodes" (excl vertices)
points=0
lines=25748 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< actual map information
boundaries=0
centroids=0
areas=0
islands=0
faces=0
kernels=0
primitives=25748
map3d=0
Closing monitors ...
To clear out the data definition, (as per GRASS definitions)
@ Level 1 :the map has one layer of information being polylines.
@ Level 2 :The topology of these polylines, consisting of a "node table" (listing all the connecting nodes) as well as a table with the "connection detail" (line 1 = from Node1 to Node2, etc).
With the **GRASS Plugin**
one can load level 2 topology as "QGis layers" being distinctly either the nodes (as points) or the connecting topology (as lines), with the NodeFrom and NodeTo line connectivity information.
How can one export the line_topo
and the point_topo
"QGis GRASS Plugin
layers" (or level 2 topology in GRASS) to shapefile (or even attribute table) making use of external command line tools? (Given that the API function Vect_set_open_level
seems to be employed by QGis GRASS Plugin
)
It is easy to do it within the QGis gui -> simply import from "QGis GRASS Plugin
layers" and then save from QGis gui. (I was not able to replicate this in the GRASS GUI though.)
So, how does QGis GRASS Plugin
avail the topological information as separate accessible "layers", but the same functionality is not available in GRASS GUI
(and for that matter GRASS)?
On a Linux system, I have made use of the bash command that exports the command string into an executable *.sh file (marked for execution) as per the GRASS tutorial ("GRASS Batch jobs" GRASS_and_Shell). This functionality allows for bashing also SAGA, where needed, from within the same bash file.
The proof of concept in making this more interactive seems viable and therefore I would much like to be able to interact more extensively with GRASS through the normal command line (outside of GRASS command line).
Realizing that there is a function Vect_set_open_level
from http://grass.osgeo.org/programming6/vector_2Vlib_2open_8c.html, it would seem as if this functionality will not be available at command prompt?
The Grass Plugin for QGis calls this function in qgsgrassprovider.cpp
.
I am not a programmer so this does not help a lot.
Just to show that GRASS 'v.out.ogr' is not able to access "topo_point" as a layer all three these commands
- v.out.ogr -e type=point input=PipePolyLines layer=1 dsn=PolyTopo.shp
- v.out.ogr -e type=point input=PipePolyLines layer=2 dsn=PolyTopo.shp
- v.out.ogr -e type=point input=PipePolyLines layer=0 dsn=PolyTopo.shp
produce the same response from GRASS
Cleaning up temporary files ...
Starting GRASS ...
Welcome to GRASS 6.4.3 (2013)
WARNING: 25748 line(s) found, but not requested to be exported. Verify
'type' parameter.
WARNING: No points found, but requested to be exported. Will skip this
geometry type.
WARNING: Nothing to export
Closing monitors ...
Can anybody assist with the simplest form of code to call "topology export" from command line as stated above?