Introduction
Spotfire comes with a selection of geocoding hierarchies stored in the Library to create maps automatically. You can also use your own geocoding tables by importing Shapefiles (.shp) and data tables downloaded from the web (see: Where to find geographic data sources for Spotfire?).
For most common map analysis, the geographical data already exists in the form of administrative areas (Country, States, Counties, Zip codes, Cities etc.) that you can match with your data as Marker or Feature Layer in a Spotfire Map chart. But the more particular and specialized a project is, the less likely it is that the data will already be available.
This article provides guidance on how to merge existing features from a Shapefile together to create custom territories or regions using QGIS.
To learn how to create Shapefiles from scratch, read this article.
To learn where to download Shapefiles, read this article.
QGIS is a free, open source professional GIS software available for Windows, macOS and Linux used to create and edit geospatial information. The instructions below are based on QGIS 3.0.
Getting started with QGIS
The QGIS User Interface
- The Menu bar provides access to all features
- The Toolbar provides shortcuts access to most common features
- The Layers panel contains the list of map features in the project
- The Map view displays map layers
- The Status bar shows the map position of the mouse pointer across the Map view and the applied Coordinate Reference System (CRS)
Creating a customer territory Shapefile
Opening Shapefile in QGIS
-
Go to Layer > Add Layer > Add Vector Layer...
-
You are presented with the following dialog:
- Browse for your Shapefile as Source, click Add and Close.
You now have your Shapefile displayed in the Map view that you can pan and zoom using the controls available from the Toolbar.
For this article, we will take the example of a company doing business in France and organized by sales territories represented as a combination of French Départements. Our goal is to create a Shapefile of the territories to be used in Spotfire. We will combine Administrative areas (French Départements) to form territories.
We are using a Shapefile of the French Départements downloaded from DIVA GIS (http://www.diva-gis.org/gdata).
Combining Shapefile features
Each area of a Shapefile is named a Feature. You can interact and edit features in QGIS using the Map view or the Attribute Table (Right-click Map layer > Open Attribute Table). Here you will learn how to merge features using the Map view as it offers a more visual and easier way to do this task.
-
Right-click the Map layer you just opened from the Layers panel and select Toggle Editing
-
Enable selecting Feature(s) from the toolbar or from Edit > Select > Select Feature(s)
-
Select the Features you need to combine from the Map view by maintaining the Uppercase key.
-
Once you've selected all Features to be merged, click "Merge Selected Features".
Your selected Features are now merged into one single Feature (your custom territory).
-
Replicate this process until you are done creating the territories.
We have successfully merged Features to form 5 territories. One last thing to be done is editing the Features (territories) to provide a name or ID to each of them to help you match these territories with your data in Spotfire.
Editing territories attributes
-
Right-click your Map layer from the Layers panel and select "Open Attribute Table".
-
Your are presented with the following dialog. From there, you can change the name of the features to your own naming.
We are ready to use our custom territories in Spotfire. Let's export our Map layer to a workable file.
Export as Shapefile to use in Spotfire
Now that we created our custom territories in QGIS, we need to export the Map layer as Shapefile for use in Spotfire.
-
Right-click the Shapefile layer you just created from the Layers panel and select Save As...
-
You are presented with the following dialog:
-
Select ESRI Shapefile as file format
-
Choose where to store your Shapefile and name it
-
The next field allows you to specify the Coordinate Reference System (or CRS). A CRS specifies how to describe a point on earth in terms of coordinates, and because there are many different ways to do this, there are many different CRSs. Spotfire's default CRS for Layers is EPSG:4326 - WGS 84. Let's select this CRS for your new Shapefile.
-
Click OK to save. Your new Shapefile is ready to use in Spotfire
You can now launch Spotfire, open your Shapefile and create a Map chart to visualize your custom Shapefile.
Recommended Comments
There are no comments to display.