Export Data from QGIS
Summary
This tutorial will explore various methods for exporting geospatial data in QGIS, whether for creating or saving new shapefiles, converting file formats for compatibility with other software, or sharing data with others. Additionally, you will learn how to save your map canvas as an image or figure, enabling you to quickly share or include it in another document.
What You’ll Learn in this Tutorial
- Export geospatial data to various file formats, including shapefiles and non-spatial formats
- Export the map canvas to different spatial and non-spatial file formats
- Create a dynamic (data-driven) map document
- Use the Map Composer to generate map atlases for specific areas or features
- Apply these tools to export maps and data of London, Ontario, and produce an atlas of its planning districts
Prerequisites
1. Preliminary Steps
- Open QGIS 3.x and make sure the Browser panel is open.
- If you currently have a project open, close it by opening a new project from the top menu Project > New OR by clicking on the New Project button on the toolbar.
- On the Browser Panel, expand the XYZ Tiles and double click on OpenStreetMap to load it into the map project. Note that the project CRS changes to EPSG: 3857 – Pseudo-Mercator.
- Using the Browser Panel, navigate to the tutorial files and load the shapefile london_planning_districts.shp
- Right click on the planning districts layers in the Layers panel and click on Zoom to Layer(s).
- Change the symbology of the planning district layer to an orange outline.
- Save the QGIS project to the tutorial folder.
2. Export Layer to Shapefile
- a. Right click on the planning district layer and click on Export and then Save Features As…
- b. Set the following parameters:
- Format: ESRI Shapefile.
- For file name, select the tutorial folder as the destination and call the file london_planning_district_export_1.shp
- Leave all other settings as default.
- Click OK.
- The new shapefile will automatically load in your project.
- Remove it by right clicking on it in the Layer panel and select Remove Layer…
3. Export Selected Features to Shapefile
- Click on the planning district layer on the Layer panel to make it the active layer.
- Use the Select Features by Area tool to select a few of the planning districts. Note that if you hold CTRL you can make multiple selections.
- Right click on the planning district layer in the Layers panel and click on Export > Save Features As…
- As in the previous exercise, save the layer as a shapefile into the tutorial folder, but call the file london_planning_districts_selected.shp
- Check the box that reads “Save only selected features”. This will ensure that only the selected features will be saved to the shapefile.
- Click OK.
- The saved file should load automatically in your map project. Note that it only contains the selected features.
4. Export to CSV
- Follow the same steps as the previous exercise, but select CSV as the Format.
- Save the CSV file to the tutorial folder.
- Open the CSV in a spreadsheet program (e.g. MS Office, LibreOffice, OpenOffice).
5. Export to Image
- With the map centered on the planning districts (use Zoom to Layer(s) if needed), click on Project on the top menu, Import/Export, and then click on Export Map to Image.
- In the Save Map as Image dialog box, keep all the default values and click Save.
- Save the file as a PNG in the tutorial folder.
6. Export to GeoPDF
- With the map centered on the planning districts (use Zoom to Layer(s) if needed), click on Project on the top menu, Import/Export, and then click on Export Map to PDF.
- Keep the default settings.
- Check the box that reads “Create Geospatial PDF (GeoPDF)”.
- Open the PDF in a PDF viewer and examine it. Note that you can toggle all layers on/off.
7. Create an Atlas with Map Composer
- Click on the New Print Layout button on the toolbar.
- In the Create Print Layout dialog box, enter Demo Atlas.
- A blank map canvas appears in the Print Composer. Add and center a map on the canvas using the Add Map tool (left side).
- On the top menu, click Atlas then Atlas settings.
- Check “Generate an atlas”
- For Coverage Layer, select the planning district layer. The page name will automatically be selected as GIS_Featur, which is fine.
- Click on the map, then click on the Item Properties tab.
- Below the Extents heading, check “Controlled by Atlas” and keep the default settings.
- Now lets test the Atlas. On the top toolbar, click on the Preview Atlas button. Note that is zooms to Uplands. Use the left and right arrows to preview other maps.
- Lets add some dynamic text. Add a text box to the upper left corner where the district name will go. On the Item Properties for the text box:
- Delete the default “Lorem Ipsum”.
- Click on Dynamic Text > Field > GIS_featur.
- Click on Font and increase the font size to 30.
- On the Atlas preview toolbar, click the left and right arrows to preview the maps with the dynamic titles.
- On the Atlas preview toolbar, click on the dropdown beside the second to last button and select Export Atlas as PDF…
- Ignore the error message “Some WMS servers (e.g. UMN mapserver)…”.
- Select a destination for the file and click Save.
- It will take some time to process, but once complete, open the PDF and examine your creation!
How can we help?
Contact us today to schedule a free consultation with a member of our team.