Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I use the ogr SetAttributeFilter with uppercases?

Code example:

lyr = shp_obj.GetLayer()
sel_str = "%s = '%s'" % (field, value)

Can I just do:

 sel_str = "UPPER(%s) = '%s'" % (field, value)


share|improve this question
up vote 1 down vote accepted

You don't need to according to the OGR SQL reference.

WHERE Limitations
All string comparisons are case insensitive except for <, >, <= and >=

share|improve this answer
I must have overseen this when I looked at the reference. Thanks mate. – LarsVegas Jul 26 '13 at 8:31

Your Answer


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.