Many Business Intelligence professionals are now discovering the power of Location Intelligence, and QuantumGIS is a run-away hit for editing, and publishing geospatial data, which is ultimately consumed by business apps.
This is a guide is for BI professionals to get the most out of QuantumGIS to create and edit spatial data for use with other Business Intelligence or mapping tools.
What is QuantumGIS
Think of Quantum GIS as the Photoshop of geospatial data. It is a desktop tool that allows users to import spatial data from most formats. QGIS provides a massive list of tools and functions to manipulate the data, similar to professional GIS tools like ESRI ArcGIS and Pitney Bowes MapInfo. Ultimately the output of Quantum GIS will be loaded into another application, map software, or result in raw data that will be loaded into a database.
Quantum GIS is FREE! It is an OpenSource solution that many GIS professionals and non GIS professionals use. At CMaps Analytics it is our recommnended tool of choice.
What skills do you need?
To use Photoshop, you don’t need to be a professional graphic designer to benefit from basic features and functions. Quantum GIS is similar.. A professional GIS expert will naturally extract more value from the tool, but for a non GIS user, you can create some amazing results with a little guidance.
What is this guide?
This guide is a no-nonsense introduction to Quantum GIS written for professionals who know very little about GIS, so you can use a small fraction of QGIS capabilities to create geospatial data that can be used with your Business Intelligence project.
We have worked with our partners at Lutra Consulting to create our own Open-Source contribution to Quantum GIS which creates custom regions / territories from boundary data.
Importing Map Layers
There are many formats to extract and load geospatial data inside of Quantum GIS. From ESRI Shapefiles, KML, GeoJSON, and vendor-specific formats like Pitney Bowes TAB files. When you import one or multiple layers into Quantum GIS, there are many different features and functions available to you.
Import a Shapefile
Select Layer>Add Vector Layer or click on the add layer icon
You are importing a .SHP file. In addition, you are required to also have the .DBF and .SHX files together to successfully import your shape file. You may also want to have a .PRJ file if one is available.
MORE READING: Click here to learn more about ESRI Shapefiles.
GEOJSON and KML
These are common web-friendly spatial data formats that are portable and can be imported into QuantumGIS.
If your data originates from Pitney Bowes, you will want your administrator to send you a TAB file which can be imported into Quantum GIS.
IMPORT FROM GIS SYSTEMS OR DATABASE
QuantumGIS has a number of connectors to load data from various spatial databases. However, this is beyond the scope of this document.
Selecting Elements on a Map
When you open QGIS, it is an overwhelming feeling with so many tools. To select and view locations on a map takes a little bit of practice. To select an elment on the map you must first click on the desired layer (if you have multiple layers).
There are two ways that you can select shapes from a shapefile:
1. Selecting from the map canvas:
Choose the select type for how you will pick shapes from your map. You can either manually click on each shape or select with a bounding box to choose multiple shapes.
2. Select from the attributes table:
The second way to select shapes is directly from the attributes table, where you can manually click on each row, or use a select statement to programmatically choose what shapes you want to edit. To open the attributes table, click on Layer>Open Attributes Table, or click on the attributes icon.
With the attribute table open, you can click “Advanced Search” to expose a simple query builder making it much easier to programmatically select the regions that you would like to modify. For example
NAME =’Brown’ OR NAME = ‘Duval’
This would select the Brown and Duval locations with you having to manually find them.
Editing your Shapefile attribute data (DBF) in Quantum GIS
Ultimately, your shapedata and region data should be driven from your business definitions. As such, you will want to modify your DBF file from within Quantum GIS.
You never want to modify your business data to fit the visualization.
a. Open Quantum GIS
b. Import a Shapefile
Select Layer>Add Vector Layer or click on the add layer icon (V1) (V2)
You will browse to a file location on your computer and select a .SHP file. You are required to also have the .DBF and .SHX files together to successfully import your shape file.
c. Open the attributes table using the menu option Layer>Open Attributes Table
d. Enable Editing or press CTRL + E
NOTE: Prior to editing a shapefile, we highly recommend saving a copy. Learn how to save a new shapefile
e. Locate the attributes that don’t match in the attributes table, double-click, and edit
f. Upon completion of making edits, click on the Enable Editing button a second time to commit your changes.
Manually Editing Layers
There are multiple ways for which you can edit shapes once they have been imported as a layer:
Turn on layer editing
To edit a layer you need to toggle edit mode on for the shape file by selecting Layer>Toggle Editing or click on the edit icon.
IMPORTANT NOTE: Before editing your layer, we recommend saving a copy of your file.
Delete Elements in a Layer
With shapes selected on the map or in the attributes table, you can delete the shapes from the file by clicking on the delete button. Once deleting the shape, the changes are applied directly to your shapefile. This is why it is important to make a copy before editing.
Commit your changes
After editing, you need to commit your changes. Simply click on the edit button or Layer > Toggle Editing.
Saving Layers and working with Map Projections
Saving output into one of many geospatial formats is extremely simple. However, dealing with projections is a heavier subject that is better explained here.
To save the new shapefile click Layer>Save edits.
This will prompt you with a screen where you will choose the file format which could be “ESRI Shapefile”, “GeoJSON” or a number of other formats, depending where you will be using this data.
Dealing with CRS.
CRS is coordinate reference system, which is important for how geography is interpreted.. Remember, that the earth is round, so while your personal experiences with maps are on a flat screen, how you represent 3D space on a 2D surface could result in skewed results. CRS is how GIS professionals can ensure the projection of a map suits the specific needs for the application (computer or printed maps).
The good news, is most modern mapping software solutions for business all use 1 CRS. The bad news is the persona who created your shape data may not have used that CRS.
Original CRS: One important aspect of GIS vs web mapping is ensuring your data is in the correct projection.
Changing the CRS: To ensure that you always have the correct map projection, click browse next to CRS, and then navigate to the option called “WGS 84”. This is a standard projection used by Google Maps and is located at:
Geographic Coordinate Systems>WGS 84
There are multiple instances of WGS 84, so the most popular one used for web maps like Google, Bing, ESRI, or OSM is EPSG:4326
IMPORTANT NOTE: If you are using an ESRI Shapefile as your source and need to change the CRS, you need a PRJ file or lookup the original CRS from the data provider.
In many cases, you may want to merge multiple multiple shapes together to make one single shape. Perhaps your western region is a combination of states, or a local zone is made up of zip codes. The merge functionality will combine the attributes and make one single shape. With your shapes selected, click on the merge button:
Before the shapes or completely merged, Quantum GIS will prompt you to decide what attribute data will be assigned to this newly merged shape.
NOTE: If you are merging shapes to create custom regions, you should skip ahead to the next section.
Create Custom Regions & Territories
The process for creating custom regions and territories was traditionally a painful, manual process. We partnered with Lutra consulting to automate and open source a plugin.
Generally you want your source file to exist as a polygon or polyline, ensuring there is no extra data bloating your file size.
This will essentially reduce the total number of data points required to draw shapes. Depending on the origin and purpose of your shapefiles, you may find that the file size is unnecessarily bloated. To simplify the geometry select:
Vector>Geometry Tools>Simplify Geometries
You will be prompted to select the new shapefile destination and a Tolerance.
Tolerance is not a perfect science for someone who is new to QuantumGIS.
Higher tolerance = more simplified shape = smaller file size
Lower tolerance = closer to original shape = closer to original file file.
For example a tolerance of .01 is going to be a smaller file size than .001.
BEST PRACTICE: You want to generate multiple files to find the happy medium between adequate precision and file size. A good starting point is “0.001.” Once, the simplified file is to your desired specification, unless you are 100% certain that the projection is correct, you may need to perform step 6 above.