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 a shapefile of contour lines, with an ALTITUDE attribute with the height ASL in metres. The source data is in 0.5m intervals, but I'd like to filter it down so I get contour lines at (for eg.) 5m intervals.

I tried doing a query on the layer using "ALTITUDE" % 5 = 0, which almost worked except I get two contour lines where I would expect one - I'm guessing this is because % is an integer operation so 245.5 % 5 and 245.0 % 5 both = 0?

Is there a better way to filter for 5m (or some other interval, say 1m or 2.5m) data?

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Multiply everything with 10 to get rid of your first decimal place:

("ALTITUDE"*10) % (5*10) = 0

This should work accordingly with any other figure.

share|improve this answer
    
I was just walking the dog and thought "Of course! I should just multiply everything by 10!"...and got home to find this. Thank you, good sir. :) –  Juffy May 3 '13 at 11:38
1  
@Juffy Next time, my answer on a question of yours will be: "Go and walk the dog!" ;) Happy multiplying! –  Bernd V. May 3 '13 at 13:25
    
Walking the dog is right up there with Atwood's "Rubber duck problem solving" perhaps. –  Simbamangu May 3 '13 at 13:58
1  
I'd prefer walking my dog over talking to a stupid rubber duck on my desk ... –  Bernd V. May 3 '13 at 15:01
    
But if the rubber duck knows the answer and you don't, is the duck really the stupid one? :) –  Juffy May 7 '13 at 1:23
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.