0

A QGIS expression (0<=0”az”<180) related to a column az with values 0 to 360 returns all records. Tried to_int and to_real as well because source of the data was a csv and result was same.

Paul Ransom
  • 317
  • 1
  • 2
  • 9
  • 1
    "az" >= 0 and "az" < 180 is more SQL ish, I don't think that ranges are supported like you stated, or at least I haven't seen a working example like that. Refer https://gis.stackexchange.com/questions/109328/select-by-attribute-between-two-numbers also have a read of https://gis.stackexchange.com/questions/89269/how-to-change-a-csv-layer-attribute-value-from-text-to-number-once-again to ensure that QGIS is seeing your numbers as numbers and not text. – Michael Stimson Dec 04 '17 at 03:09

2 Answers2

1

Something along the lines

if(0<=to_int(az)<180,do one thing,do another thing)

should work for the field calculator. Make sure to check which field type "az" is (layer properties -> fields), maybe you can leave the "to_int" out. Refering to the column has to be without quotation marks in this context - don't ask me why.

Erik
  • 16,269
  • 1
  • 24
  • 43
0

Thanks Michael and Erik as the references and comments were helpful in reaching the following solution: "az" >= 0 and "az" < 180 By the way the attribute table was numeric as every value had a huge number of decimal places. Clicking on the field headers sorted the table. QGIS claims a certain level of SQL capability for expressions and this problem is entry level stuff that still intimidates rookies like me. Paul

Paul Ransom
  • 317
  • 1
  • 2
  • 9