Bug report #1095

3-D GRASS line vectors from r.contour - Cant query or identify the lines, but can label the attributes

Added by dadudeman - over 15 years ago. Updated over 13 years ago.

Assignee:Lorenzo Masini
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:

Hi everyone.
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
638759.35668041 224267.86790137
638748.56434918 224206.16089597
638738.04094476 224149.69241332
638701.95659054 224155.1582149
638712.48508636 224219.60539241
638727.41956522 224217.30778103
638737.10320251 224271.95933017

So it seems to me that this is a flaw in QGIS' handling of this type of data.



#1 Updated by Paolo Cavallini almost 14 years ago

confirmed on

#2 Updated by Redmine Admin over 13 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.

#3 Updated by Redmine Admin over 13 years ago

It was also fixed in GRASS 6.4.1

Also available in: Atom PDF