
QGIS 2 Cookbook
By :

QGIS supports multiple formats, not just to read vector layers but to also save them. This recipe shows you how to export a vector layer, converting it to a different format.
You will use the layer named poi_names_wake.shp
in this recipe. Make sure that it is loaded in your QGIS project.
The OGR library, which is used by QGIS to read and open files, is also used to write them. Not all of the formats that are supported for reading purposes are also supported for writing purposes.
You can export even the layers that are not originally file-based to a file, such as a layer coming from a PostGIS database or a WFS connection. Just select the layer in the table of contents and proceed as just explained.
The Save as dialog allows additional configuration beyond what you have seen in the example in this recipe.
Depending on the format that you select to export your layer, different options are available to configure how the layer is exported.
The options are shown by clicking on the More options button. Select GeoJSON as the export format and then display the options for that particular format. The COORDINATE PRECISION option controls the number of decimal places to write in the output GeoJSON file. The default precision is too high for almost all cases, and most of the time, having three or four decimal places is more than enough. Set the precision to 4
, enter a valid path and filename, and export the layer by clicking on OK. Your points layer will now be saved in a smaller GeoJSON file. You can open this with a text editor to verify that the coordinates are expressed with the selected precision or compare its size with the one created without specifying a precision value.
If you want to work with the layer after it is created, check the Add saved file to map box. The output layer will be opened and added to your current QGIS project.
Change the font size
Change margin width
Change background colour