FOR QGIS:
You can use below expressions:
replace((regexp_replace("YourField", '(?!^)([A-Z])', ' \\1')),' ', ' ')
N.B. I am surprised that qgis does not support negative look behind though python 2.7 fully supports it.
FOR ArcGIS:
Basically, this answer is equally applied for ArcGIS and QGIS. I will use regular expression to solve the problem
I would use below function in the arcmap field calculator:
import re
def spacer(text):
return re.sub(r'([A-Z])',r" \1",text,re.MULTILINE).strip()
or below if there is a single space already before any capital letter in the passed text.
import re
def spacer(text):
return re.sub(r'([A-Z])',r" \1",text,re.MULTILINE).strip().replace(" "," ")
Example:
![demo](https://i.stack.imgur.com/JSoH3.png)
Explanation:
I used re.sub(r'([A-Z])',r" \1",text,re.MULTILINE).strip()
lets explain it.
re.sub
just grabs all that matches ([A-Z])
from the input text
and replaces it with the exactly that character but with leading space but it, thus, adds a leading space in the beginning of the line which is unwanted.So I used strip()
function to remove unwanted leading and trailing spaces.
Explanation of the regular expression ([A-Z])
: It grabs all single character capital letters.
Explanation of the regular expression r \1
: Here r
is just a formatting flag and in space+\1
, \1
is called backreference which returns the character grabbed by the previous regular expression.So replacing text is the exact Capital letters that grabbed by the previous regex plus the leading space.
Best Answer
One option to do this would be by modifying your data and visualizing it with the excellent qgis2threejs plugin. The idea is to turn your your time to Z coordinates. I tried it out with two GPX tracks I had. After adding the files to QGIS, I ran Set Z value algorithm, where I entered the following expression as the Z value:
The expression takes the timestamp (stored in my data in a field called "time") from each point feature and compares it to the minimum timestamp in the whole layer. This calculation results in to an interval data type, which can be converted to integer seconds with the second function. For this to work with your data, you might have to use minutes or hours or use some kind of a multiplier.
Next up you should install the qgis2threejs plugin via the plugins dialog. If you have data with Z coordinates in your project it should detect that automatically and you can visualize the results with additional data and a basemap if you want. I also merged the layers and added a extruded polygon from the bounding box as the "cube":