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.

Does anyone know of a way to capitalize the first letter of each word in a field in an attribute table? I am doing this in QGIS. I know of field calculations to change all the words to Lower or Upper, but I would like to be able to have the first letter Capitalized of each word, and the remaining letters lower cased. I know how to do this manually, but I am looking for an automated way. Similar to the Proper command in Excel.

Thanks...

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Using the python field calculator:

http://hub.qgis.org/wiki/17/Using_Python_to_calculate_attribute_values_with_'fieldpyculator'

You should be able to us the .title() method on your strings:

http://stackoverflow.com/questions/3728655/python-titlecase-a-string-with-exceptions

Edit:

Assuming the attribute field you want to change is "FIELD", the sintax to use is:

value = <FIELD>.title()
share|improve this answer
    
Thank you, this seems to be on the right track, but I am a little confused with the syntax. From reading the links and others, I assumed it would be: value = str.Title( <BLD_NAME> ) but that gives a syntax error. Is there something else I need to add before str? –  Ryan Garnett Apr 15 '13 at 9:01
1  
Take a look into my Edit, in your especific case, it will be: value = <BLD_NAME>.title() Notice that Python is case sensitive. Also, title() is not a function but a method of the class string, that's why the syntax is string.title() –  Alexandre Neto Apr 15 '13 at 10:23
    
Thank you, that would exactly as I hoped. –  Ryan Garnett Apr 15 '13 at 10:36

The feature is already integrated at Qgis.

The following screen shot is from version QGis 1.9-Master, but most probably exists in previous versions as well.

enter image description here

share|improve this answer
    
I am using 1.8.0 and it is not available. –  Ryan Garnett Apr 15 '13 at 8:53

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.