- Software: QGIS 3.20
- OS: Any
- Created: August 2021
I’m working with some data and have a column “typesuffix” with extra spaces in it. This happens with data occasionally – you can have spaces before/after or in the data you don’t want or need.
The data should have a value ‘Rd’ with no space – but instead I have ‘ Rd’
Open Field Calculator and use the trim function. In my case the field holding the data is called “typesuffix”.
This takes us from ‘ Rd’ to ‘Rd’ by using trim(“typesuffix”) and all the trailing and leading spaces are removed
what if you have spaces in names you don’t want? Maybe I have an attribute that is ‘Q G I S’ and it needs to be ‘QGIS’. Use the replace function and do the following: replace(‘Q G I S’, ‘ ‘, ”) which says take the attribute with spaces and replace the spaces with no spaces.
Want QGIS Training? Need help with a project? Give us a shout at info at northrivergeographic.com