QGIS 11 Modifying data
Maybe you have a map or map data, and you would like to refine the data. For example, the VectorMapDistrict data has a layer for ‘Woodland’. Perhaps you would like to show what kind of woodland e.g. ‘conifer’, ‘ancient’ or even as precise as ‘birch’? Good though the Ordinance Survey map‐data is, it does not contain this level of information. So you need to add the information to the base file data.
WARNING: How to approach modifying–duplication vs. attributes
If you’ve used a graphics editor, raster or vector, the natural way to split data is to duplicate a layer. Then work on each layer, filtering the information as you wish (‘ancient’ woodlands on one layer, ‘conifer’ on another) Well, a massive warning here. QGIS works from files. So if you duplicate layers, you are still working on the same base file. Delete from one ‘duplicated’ layer, and you’ll delete from the other layer also. If you know computer code, this is a variation of the old ‘shallow’ vs. ‘deep’ copy issue.
There’s reports all over the web, for many versions of QGIS, that copy and paste makes the same ‘shallow’ copy of data, so that’s no use either. And no, deep copy is not what ‘Layer Definition’ files are for. Layer Definition Files bundle styling with content, and will perform the same shallow copy.
There’s two ways I can think of to tackle this. Which you choose is for you to decide,
Clips
A QGIS clip must reform all lines crossing the clip edges, so QGIS will not try to track the data, but builds the data again. The upside to this method is that you can create many layers from one, so have ‘ancient woodland’, ‘conifer wpodland’ and ‘other woodland’ on separate layers. Editing one layer will not affect another. However, there are downsides to this method,
If you are not clipping, it’s much time
You may not know in advance how many layers you need, and it’s awakward to reverse and reload the clipping project to generate more layers
Arguably, different layers is not how you should represent a change of attribute such as ‘woodland type’.
Add extra attributes, then make conditional styling
You add an extra attribute to the data in the ‘Woodland’ layer, called ‘TYPE’ or similar. Then make styles that target the attributes. The information on how to do this is in this section, look down. For data structure this is the usually the correct method. But this method also has downsides,
Editing the base data is not as simple as deleting a mass of objects from a layer. I agree QGIS has made data editing easy, but not as easy as hand‐driven mass select and delete
QGIS is well‐equipped for targetted styling, but it’s not as easy as handling different layers
Clearly this will work amazingly well to isolate a couple of features for graphics, or correct an entry. But take one of my cases—I had over 4000 entries that needed general classification into maybe seven categories. That’s near possible this way. It’s enough to make you print off the map and start with Inkscape. Other power is needed.
Editing file data
There would seem to be two methods to edit base data,
Use editors on the base files
For example, some special editor for Shapefiles. In fact, the datafiles of a Shapefile are a spreadsheet style database, and will open in any spreadsheet editor. Or, for GML files, use an XML editor.
Discussion on editing the base files
This would seem to be the direct, fast, and power‐tool way to make map‐data edits. However, there are downsides, some weighty,
The files for holding geospacial data are often customised. You could break the connection between the files
Niether of my spreadheet applications, one of them is very good, are able to edit or save Spacefile data (they can load it)
Spacefiles contain uneditable binaries, and GML files are often split across many small files
The end is that direct file editing may work to isolate a couple of features for graphics, or correct an entry. But is not often a good solution.
QGIS editing
Can QGIS edit the data in files? Then write to them? Yes. Indeed, all the information I’ve found online suggests QGIS editing as the route to take.
The Attributes Table
Like this,
Layer > Open Attribute Table
then,
[Button] New Field > [give a name, set the type of data]
One issue here is isolating which information we wsh to change. QGIS tries to help. It can pan to the selected attribute rows (CTRL‐J). If in view, the display will then indicate the selection on the map.
Clearly the attributes table can be used to isolate a couple of features for graphics, or correct an entry. But take one of my cases—I had over 4000 entries that needed general classification into maybe seven categories. That’s near possible this way. What would be needed would be the reverse of the above, which is to select on the map then highlight the rows. Far as I know, QGIS can not do this. However, QGIS has method for converting multiple attributes— you need to switch process then work through the interface.
Attributes multiple editing via the GUI
Select many features on a layer. Use one of the methods in the navigation and selection step. Then,
[also button] Layer > Toggle Editing
[also button] Edit > Modify Attributes of Selected Features
[also button] Layer > Save Layer Edits
Note the last step—this edit will not be written to the file unless explicitly told (also, the edit can be cancelled).
Styling by attributes
Lets say you’d like to categorise one of the layers. Maybe you’d like to split ‘woodland’ by ‘type’?
Maybe first it is good to check, using a spreadsheet application, the .dbf file, see what data is there. If the data you want is there, but the styling is not, you will save a lot of work. But we’ll assume the data is not there.
Create a new field
Select the layer
[Right click] Open the attribute table
[button] Add Field
Give a name and the type of data you want to store (this is just like a spreadsheet)
Close the manager
Select features, modify field data
[ensure ‘on’] Toggle Editing
Select some features on the layer, see above
[also button] Edit > Modify Attributes of Selected Features
In the entry box for the new field, type in some data
Press ok
[!important] Save Edits
To style features by the new field and categories
[also double‐click] Layer > Properties
[select] Symbology
Change to ‘rule‐based’
[button] Add a rule
Modify filter to ”PROVIDER” = ’oak’
Make the symbol into an oak tree, or an oak‐coloured dot, or something
There’s an amazing button in the interface here, called ‘Test’. After you enter the rule, try use test, to see if you get any matches.
End of custom editing
Now we have a product, let’s do what we wanted to do for a long time, output