Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have SHP layer loaded in QGIS. It consists of lines with attribute column z, containing integer value associated with line elevation in meters. Lines are drawn at 10 meter increment, and I want to apply style to lines on 50 meter increment.

For that purpose in "Style" tab in "Layer Properties" dialog, I use "rule based" style and want to define above described rule. From available operators I can see only one possibility with this filter expression:

z/50 - toint(z/50) = 0

However it returns true for all lines, while I expected just those with 50 meter increment.

There is also "Expression builder" dialog, but it does not return results from typed expression, for some reason, and I'm not able to determine what is the problem?

Any ideas?

share|improve this question
add comment

1 Answer

I'm not sure, as already mentioned expression output is not available, but I guess that expression evaluation is like in Python - if float number isn't used result is integer regardless real value. So this worked for me:

z/50.0 - toint(z/50.0) = 0

in lack of modulo operator

share|improve this answer
2  
Mod is the symbol %. Yes the QGIS expression engine will return a int if both sides are ints, if one is a float it will return a float. –  Nathan W Dec 2 '12 at 22:18
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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