October 11, 2021
Convert GML/GeoJSON to shapefile with QGIS
Quick tutorial on how not to get loss in the sea of spatial data format
584 words | 3-min read |
Use QGIS to import, convert and export spatial data that cannot be directly read into ArcGIS Pro.
The pain of getting correct spatial data file format
Sometimes, spatial data are not available in shapefile (
.shp) format. And you may experience difficulties when importing those data to ArcGIS Pro. Dealing with non-shapefile or non-geodatabase format spatial data in ArcGIS Pro could be troublesome sometimes.
Examples are Large Tertiary Planning Unit (TPU) spatial data and Large Street Block Group (LSBG) spatial data available in the Hong Kong GeoData Store, which spatial vector data are only available in GML format.
In these cases, a quick workaround is to convert those data to shapefile first. QGIS provides a FREE and OPEN-SOURCE software (with graphical user interface) to convert between various spatial data format.
But what is spatial data file format?
Files in your computer, in most cases, have specific file formats for software to understand how to read them. Taking audio file as an example, there are
.m4a (and more) audio files. Specifying the file format allows iTunes or Windows Media Player to understand how to read the file and play the music for you.
In some cases, you need to convert your music file to another format. Say, you want to convert
.alac in order to import the music to iTunes. And audio file format convertor softwares are available for you to convert between different audio file formats.
QGIS is offering the same kind of help here - instead of audio file format conversion, QGIS is offering its helping hand for spatial data format conversion.
There are more than 100 types of spatial data format across the ocean of GIS. You have experience in dealing with shapefile (
.shp) and geodatabase (
.gdb) in the current state. Yet there are also some common spatial data you will come across in the wild:
|Geographic Markup Language
|Keyhole Markup Language
How to convert spatial data format in QGIS
Step 0: Download and Install QGIS
Go to the official QGIS website (https://www.qgis.org/en/site/forusers/download.html) and download the QGIS Installer.
QGIS is also available on Mac and Linux!
- Install it according to the instructions! (Trust me, having both ArcGIS and QGIS installed is useful for spatial analysis.)
Step 1: Open a new project
Open QGIS, click the white paper icon on top left of the toolbar to create a new project
A blank layout view will be create like below.
Step 2: Add the spatial data file into QGIS
Drag the Large TPU GML file (or other non-shp data you found) from file explorer to the Layers panel (Same as Table of Contents in ArcGIS Pro)
Step 3: Export the file
Right Click the layer in Layers panel, then choose Export > Save Feature As…
ESRI Shapefileas the Format
For File name, Indicate the folder you want to store the file and name your file.
Leave other options as default
A green bar appear will on top of the map frame after the export function runs successfully.
Check your directory to see if the spatial data is correctly exported. Remember that shapefile is a multi-file document including (but not limited to) files with extension of
Shapefile is an old data format and has a number of shortcomings. Switch to other formats if possible.