Jump to content
  • Creating custom territories by merging Shapefile Features


    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


    1. The Menu bar provides access to all features
    2. The Toolbar provides shortcuts access to most common features
    3. The Layers panel contains the list of map features in the project
    4. The Map view displays map layers
    5. 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

    1. Go to Layer > Add Layer > Add Vector Layer...





    2. You are presented with the following dialog:





    3. 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.

    1. Right-click the Map layer you just opened from the Layers panel and select Toggle Editing





    2. Enable selecting Feature(s) from the toolbar or from Edit > Select > Select Feature(s)





    3. Select the Features you need to combine from the Map view by maintaining the Uppercase key.





    4. Once you've selected all Features to be merged, click "Merge Selected Features".


      screen_shot_2018-05-02_at_15_25_36.png.342c1cbdf375f6ff9350e0a4f281e673.png screen_shot_2018-05-02_at_15_28_52.png.78959c5464057bceb1ace4d6d4831486.png


      Your selected Features are now merged into one single Feature (your custom territory).



    5. 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

    1. Right-click your Map layer from the Layers panel and select "Open Attribute Table".





    2. 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.

    1. Right-click the Shapefile layer you just created from the Layers panel and select Save As...





    2. You are presented with the following dialog:





    3. Select ESRI Shapefile as file format

    4. Choose where to store your Shapefile and name it

    5. 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.

    6. 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.



    User Feedback

    Recommended Comments

    There are no comments to display.

  • Create New...