How to interact with GRASS GIS vector map topology ‘level/layers’ from terminal/command line? – Geographic Information Systems Stack Exchange
Is there anybody out there that can maybe assist in the most 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? So 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, (‘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’) SO, 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). Edit : 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? Just to show that GRASS ‘v.out.ogr’ is not able to access ‘topo_point’ as a layer all three these commands Is there anybody out there that can maybe assist in the most simplest form of code to call ‘topology export’ from command line as stated above? The GRASS command v.out.ogr, which you would use to export a vector to a shape, takes a layer= parameter. This way you can export separate layers from a GRASS vector. The values would be 0,1 etc. But when you say ‘vector map has multiple layers’ I assume you mean that the vector contains both points and lines. In this case use the type= parameter to get only points or lines. Source.