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.

Sorry if this is a dumb question, but I am wondering if there is a way to copy the text from one field to a new field, but eliminate specific words. For example:

**Old Field**                         **New Field**

Killbear Provincial Park               Killbear
Quetico Provincial Park                Quetico
La Cloche Provincial Park              La Cloche
Wildcat Hill Provincial Park           Wildcat Hill

I thought of trying a trim function, but not all the values have the same start location or trim length.

Thanks...

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

In your attribute table create a new string column and then use the field calculator as follows:

 replace(OLD_FIELD, 'Provincial Park','')

The problem with this approach is that your fields won't be trimmed, so you can do the following little hack to address that:

 replace(OLD_FIELD, ' Provincial Park ','')
 replace(OLD_FIELD, ' Provincial Park','')
 replace(OLD_FIELD, 'Provincial Park ','')
 replace(OLD_FIELD, 'Provincial Park','')
share|improve this answer
1  
Thank you, that worked great... –  Ryan Garnett Sep 7 '12 at 13:46
add comment

How about removing all the occurrences of " Provincial Park" A search/replace ought to do the trick.

share|improve this answer
    
Thank you work. I didn't know you could do a replace in QGIS, I see the Search option, but not the replace –  Ryan Garnett Sep 7 '12 at 13:03
    
If you're working with a shapefile, you could edit the .dbf file directly with Excel and do your search/replace there. Unfortunately newer versions of Excel (2007, 2010) no longer let you save to DBF. Would work if you have Excel 2003 or earlier. –  Rayner Sep 7 '12 at 13:07
1  
There's always LibreOffice Calc which handles DBF files just fine. –  n1kn0k Mar 6 '13 at 3:32
    
Good to know. Wasn't aware of that. Thanks. –  Rayner Mar 6 '13 at 12:57
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.