I have a big set of contour lines with 5 m and 10 m stepping from an ArcGIS File Geodatabase (wasn't a shapefile, as previously stated).

From time to time I need to modulo out the 5 m lines in the viewer. Given a column "contour" this should work (shouldn't it?):

"contour" % 10 = 0

However, it returns 0 lines with both, double or integer type. The column contains just values of xx0 and xx5.

  • Not totally clear from your post...are you certain of the data type of the 'contour' column? If it's a string, you might do a regex search like "contour" = '%0' or something. – Nate Wessel Nov 27 '14 at 1:43
  • 1
    The Modulo operation syntax is database specific, with no standard that works across all databases. Shapefiles use MOD("contour", 10) = 0. See the SQL reference at help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… – Richard Fairhurst Nov 27 '14 at 5:31
  • @Richard Fairhurst within QGIS, the Modulo syntax is standard regardless of the data source. – MappaGnosis Nov 27 '14 at 8:36
  • Your expression should work (I assume you are entering it as a layer query filter). I think you need to give us a little more information (especially if this isn't a query filter). @ Nate Wessel, I would expect a "Data Type Mismatch" error if the contour field was a string. – MappaGnosis Nov 27 '14 at 8:47
  • @ Nate Wessel, I tried both, double and integer - its not string. @ Richard Fairhurst, it doesn't work the ArcGIS way using mod("col",x)=0 @ MappaGnosis, yes its a layer query using the properties dialog. Actually I use integer for the contour level column (befor I had a column of type double). And I made a mistake (see edit of my post - its not a shape, its an arcgis file geodatabase. Sorry for that, the plan was tu prepare a shape, but the size of the file would exceed 2 GB, which approx. was the limit of shape file, I guess. – tlange Nov 27 '14 at 9:40

Perhaps you have this in an if statement. Also, if you want 5m lines, modulo 10 won't work, you'd need modulo 5.

As an aside, 0 in computer speak is generally considered equivalent to FALSE, 1 or non-zero to TRUE. In some languages this is explicit; you can test for = FALSE or = 0, same thing. FALSE is just a built in constant set to 0.

I realize changing your title changed your contextual emphasis, but this is probably where the mod was coming from.

  • "contour" % 10 = 0 --- doesn't contain any if... Maybe I was mistaken, with "modulo out" I ment dont show 5 m contours. By all means... Any data query in this world that returns 0 lines is not returning false, but an empty data set. – tlange Dec 2 '14 at 23:55
  • 1
    Well, I have to assume you're using some kind of programming/sql language within your gis here, which by your tag is qgis. I admit I'm not very familiar with qgis, but my understanding is that it follows common GIS protocols. – recurvata Dec 3 '14 at 1:23
  • 1
    An empty dataset has a value of zero. This is built into the language. You also mention there's no if clause. You need to post some more information on what your data is, what results you expect, etc. – recurvata Dec 3 '14 at 1:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.