1

This is my first question on this site: it is probably already been exposed many times, but try to forgive me if I could not find it. Secondly, English is not my native language, I will try to be as clear as possible.

I am creating an archaeological map with a simple point shapefile. But I need to be able to enter multiple values in a single field of the attribute table. For example, an archaeological site can belong to different phases, in my case "Achaemenid" and "Sasanian". How do I do this thing, making sure that QGIS consider "Achaemenid" and "Sasanian" two different attributes even if they are in the same field?

  • A Field or column can have unlimited number of unique attribute values or may be controlled to a defined value list, can you elaborate more what you mean by "How do I do this thing, making sure that QGIS consider "Achaemenid" and "Sasanian" two different attributes even if they are in the same field?"? – artwork21 Nov 24 '15 at 12:56
  • Do I understand this correctly? there are several phases available and each site can belong to one or more of the available phases. – Matthias Kuhn Nov 24 '15 at 13:25
  • Yes Matthias, that's exactly what I mean! – Mike81 Nov 24 '15 at 14:06
3

(Caveat: fairly new to qgis, so someone else may show up with a better answer)

I think there are a couple ways of addressing this requirement. This answer is a little hazy because it's not clear exactly what you mean by "making sure that QGIS consider "Achaemenid" and "Sasanian" two different attributes...".

From a database-centric point of view, you would typically not try to store multiple values in a single field like this: you would instead have a mapping table that would map feature ids to phases, and then to find all the phases for a given feature you would perform a table join. This is relatively easy if you're using a database backend like postgis or something, but doesn't really map well to the features available in a shapefile.

Another option is to use a simple text field and store your phases (e.g., as a comma delimited field), and then use LIKE queries for selecting/filtering/etc. For example, to find all features with the "Achaemenid" phase:

"phases" LIKE '%Achaemenid%'

That works fine, but isn't necessarily going to be performant if you have thousands of features.

  • Thank you, I will try this and let you know if it's useful! Maybe my problem will be more clear if I explain one of my goals: I have to create a thematic map for every historical period in northwestern Afghanistan. So, if for example I have City A built by Achaemenids and still living under the Sasanians, City B built by Achaemenids and with no trace of Sasanian occupation, and City C built by Sasanians, my "Achaemenid" map should show A and B but no C, while my "Sasanian" map should show A and C but no B. – Mike81 Nov 24 '15 at 16:57

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.