0

I received the following files:

.shp .shx .dbf

I opened the shapefile using QGIS 2.18 and I see there only one layer. I did Add vector layer.

I'd like to be able to color different regions with different colors. Is this possible, having one single layer? How? (Even if by using another software)

I'm new to this. I did Add vector layer for importing. Maybe I could do this by importing the file differently, and not have one single layer.

Or maybe I could modify the .dbf file and add a new column for colors. I don't know.

My .dbf file looks like this:

enter image description here

  • 3
    This is a very basic task. Have you done any research, for example on QGIS help pages? – BERA Dec 6 '17 at 10:13
  • 1
    I actually did and could not reach the full solution (also exporting it back as shapefile containing colors) – Ben Dec 6 '17 at 10:28
3

Right click the layer in the "Layers Panel" (probably to the left of your QGIS window).

Select "Properties".

Select the "Style" tab on the left hand side of the window that pops up.

Select the first dropdown menu at the top and choose "Categorized".

Select the column you would like to colour by in the second dropdown menu.

Left click classify below the large white box. This will populate the white box with a list of the varients in the selected attribute. You can keep the defualt colours or double click on the colour to the left of each category and choose your own.

Should look something like this:

enter image description here

.shx is the index for the shapefile, .dbf is your attribute table for the shapefile. Keep all three files together.

  • hi, thanks for the answer. I choose Random colors, but when I choose from Column dropdown, nothing appears... – Ben Dec 6 '17 at 10:18
  • Sorry, my bad, forgot to clcik classify. It seems to work. The only problem I have now is: Could I export the new colored map again as the export I did? (those 3 files only)? – Ben Dec 6 '17 at 10:19
  • I'd like to know if somehow I can add a new colum in the dbf representing colors... – Ben Dec 6 '17 at 10:21
  • 1
    What exaclty are you trying to accomplish? Your colours should represent something else, i.e. a differentiating attribute. What do you want to export? The colur scheme? A static map? Another shapefile? If you really want to add another column, toggle the layer into editing mode (the pencil button) open the attribute table, and select the Add new field button. – whjd Dec 6 '17 at 10:24
  • Let me try to explain one more time. I want to somehow have a color attribute inside my shapefile. How do I do it? Could I just add a column in the dbf? Or maybe edit the shapefile / shx? I tried right click layer -> save layer as but the colors are not saved. – Ben Dec 6 '17 at 10:26

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.