Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Creating custom territories by merging Shapefile Features


    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

    gui_0_0.thumb.png.75720cd1c0d99b51bc41848cc739306d.png

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

       

      screen_shot_2018-05-02_at_14_55_30.png.b8af97c1cd16b55e22f3ce4f624554f1.png

       

       

    2. You are presented with the following dialog:

       

      screen_shot_2018-05-02_at_14_57_35.png.5cf6747492575014617695e747ede626.png

       

       

    3. Browse for your Shapefile as Source, click Add and Close.

    screen_shot_2018-05-02_at_15_01.38_0.thumb.png.638bd3c4fa7600dc5f3f13b278bc0031.png

     

    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

       

      screen_shot_2018-05-02_at_15_08_11.png.b90efae1bdca3f35463d1c4e8f219a21.png

       

       

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

       

      screen_shot_2018-05-02_at_15_21_27.png.d4415ce402a03fc5807efcb4faf3d1df.png

       

       

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

       

      screen_shot_2018-05-02_at_15_24_38.png.72f40514ec12ff7460e6aa6bee4d8ade.png

       

       

    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.

       

      screen_shot_2018-05-02_at_15_33_26.thumb.png.2472a6022afd8a5e764dcfa7bfd133ba.png

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

       

      screen_shot_2018-05-02_at_15_35_44.png.34682e3604817757b5b23bd76bfca26a.png

       

       

    2. Your are presented with the following dialog. From there, you can change the name of the features to your own naming.

       

      screen_shot_2018-05-02_at_15_37_14.png.a34c4ac73e27edd9cb1490f6cb3240ba.png

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

       

      save_0_0.png.2f24774014c288222064f771ea154541.png

       

       

    2. You are presented with the following dialog:

       

      savefin_0_0.thumb.png.1cda477feba68c8f50e139b4f596bac0.png

       

       

    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.

     

    screen_shot_2018-05-02_at_16_25..thumb.png.41b3f7ad1fca363bd01dbbb5b0129704.png


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...