I have a GeoJSON file in QGIS and I created a column in its attribute table with column type: String list. I want to each cell to have two strings. The two strings are urls.

I tried:

  1. 'https://i.imgur.com/EKJmqui.jpg', 'http://freakplaces.com/img/Cannon_Beach17.jpg'
  1. ['https://i.imgur.com/EKJmqui.jpg', 'http://freakplaces.com/img/Cannon_Beach17.jpg']

  2. list('https://i.imgur.com/EKJmqui.jpg', 'http://freakplaces.com/img/Cannon_Beach17.jpg')

These didn't work. Is there something I'm missing?

Relevant image: https://imgur.com/S07lmwb

  • You want to write these strings into the attribute table?
    – Erik
    Sep 23 '20 at 8:15
  • Yes. Since it's a geojson file, I want each row in the column Images to contain a list of strings. The first element in the list should be a url and the second element another url. Sep 23 '20 at 8:21
  • Are these URL the same for all features?
    – Erik
    Sep 23 '20 at 8:29
  • Yes, every feature should have these two URLs. Sep 23 '20 at 8:31

Open the field calculator.

enter image description here

Choose the field you want to add or edit, then enter the following expression:

'https://i.imgur.com/EKJmqui.jpg, http://freakplaces.com/img/Cannon_Beach17.jpg'

What you did was selecting all features which had this text in that field.


First of all, your field must be of type QStringList. You can check this in the properties of your layer in the Fields tab.

Then you update your field with the following method (array('value1','value2', ...)):

array('https://i.imgur.com/EKJmqui.jpg', 'http://freakplaces.com/img/Cannon_Beach17.jpg')

  • I couldn't figure out how to create a field with the type QStringList. The string related options are Text (string) and String List which result in field types Qstring and QVariantList respectively. Sep 23 '20 at 9:13
  • You can choose this type by using the add field button (more types are available) in the attribute table and not in the field calculator Sep 23 '20 at 10:05
  • The only options I get are whole number (integer), whole number (integer 64), decimal number (real), text (string), string list, and boolean. image: imgur.com/pW6DSdN Sep 23 '20 at 10:28
  • Curious, I tried on QGIS 3.4 and QGIS 3.14 and I have many more choices. You can also add a field via the fields tab in the properties but I think it won't change anything. Sep 23 '20 at 12:27
  • That's weird. I also have QGIS 3.14 and I tried to add a new field from the fields tab in properties and the choices are the same. Maybe it has to do with the type of file that is being edited. My observations are for a GeoJSON file. Sep 24 '20 at 13:09

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.