Bug report #1095
3-D GRASS line vectors from r.contour - Cant query or identify the lines, but can label the attributes
|Affected QGIS version:||Regression?:||No|
|Operating System:||Linux||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||11155|
I noticed this in previous releases too. When I use r.contour in GRASS to create contour lines from a GRASS raster, from what I gathered they are 3D lines, which I cannot identify or query in QGIS. I can only label the "level" attribute, which gets the elevation assignment from r.contour.
I originally submitted this to the GRASS mailing list because of ambiguity on the "level" terminology, but after some testing, Moritz found that it is a QGIS issue. In GRASS, I can query/identify the lines and get the values in the output screen. If I convert the GRASS vectors to a shapefile, the attributes are written out ok and I can then query them in QGIS.
Here is the correspondence from the GRASS list, and how Moritz determined the 3D line as an issue:
On 16/05/08 17:26, M S wrote:
I had generated some contours from a DEM with r.contour. In the resulting vector contour map, I get cat and level, where level is the elevation value. I must be confused with the level terminology, because I thought levels pertained to topological (2) or non-topological data (1). However, in r.contour output, "level attribute" corresponds with the contour elevation.
In GRASS the same words sometimes have different meanings according to context. Generally for historical reasons...
Regardless, I'm able to query the lines in GRASS monitor to get the cat and level (elevation) values for the contour lines, but in QGIS I'm unable to query or identify the features. In QGIS, I am able to label the lines on the "level" item though.
I refrained from cross posting to QGIS list, because it seems like something I'm not understanding in GRASS vector model.
Any ideas why the features are (repeatably) unidentifiable in QGIS, but are viewed and labeled without issue?
No idea, but I can confirm with the North Carolina demo data:
- elev_contour_3m: no data found
- any other line layer (streams, busroutesall, etc): I get the relevant info
After a bit of testing, it seems to me that this is due to the fact that the contour lines have 3D points as vertexes, i.e.:
v.out.ascii elev_contour_3m format=standard
L 309 1
644845.39132067 228495 58
644850.5257363 228485 58
644855 228476.80568172 58
644856.10080552 228475 58
whereas the others have 2D points as vertexes, i.e.:
v.out.ascii busroutesall format=standard
L 40 1
So it seems to me that this is a flaw in QGIS' handling of this type of data.
#2 Updated by Redmine Admin over 11 years ago
- Resolution set to fixed
- Status changed from Open to Closed
Yes, bug, I have fixed it in QGIS changeset:12738 but it is not perfect. QGIS is using Vect_select_lines_by_polygon and it is selecting lines using bbox of the passed polygon. I have just set z coors to -PORT_DOUBLE_MAX/PORT_DOUBLE_MAX to cover 3D. It should be better specified in GRASS how Vect_select_lines_by_polygon treats 3D vectors, but until they touch the function, it works in QGIS.