I am using QGIS actions (type: "open") to link ECM searches to objects on the map.

The basic syntax is very simple:


However, some fields used for the search contain spaces and the system can't handle them. For example, "York" works. "South Hampshire" however doesn't.

Can I somehow mimic the open action with python, and use it to manipulate the value from the field? Like picking the first word before a space and using only that for the search?


Figured I might as well post the answer I came up with here:

from os import startfile

baseurl = http://www.google.com/
someattribute = '[% "attributefield1" %]'
someattributesplit = someattribute.partition(' ')[0] #get word before first space
path = baseurl+someattributesplit


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.