Jump to content
We've recently updated our Privacy Statement, available here. ×
  • Creating custom Shapefiles for Spotfire®


    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 digitize custom geographic areas by creating a Shapefile (or map feature, or polygon) using QGIS to use in Spotfire.

    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. gui_0.thumb.png.3fa0e03a47c356e4df92f619018edbd7.png
    2. The Menu bar provides access to all features
    3. The Toolbar provides shortcuts access to most common features
    4. The Layers panel contains the list of map features in the project
    5. The Map view displays map layers
    6. The Status bar shows the map position of the mouse pointer across the Map view and the applied Coordinate Reference System (CRS)

    Drawing your own Shapefile

    Add a map background

    Adding a map background will help us draw map features according to the geography. QGIS offers OpenStreetMap (OSM) as built-in map background. Here is how to enable OSM as a new map layer:

    1. Go to Layer > Data Source Manager

       

      datasource_0.png.4fdb960a242953ff4c182876044a91a1.png

    2. You are presented with the following dialog:

      osm_0.png.b4047ec2ac7c607c5c9920ecb702aa19.png

    3. Double click "OpenStreetMap" to add it to your Map view

    You now have a map background you can pan and zoom using the controls available from the Toolbar.

    map_2.thumb.png.1d8c1accd5b633c10064e7ff1b0b31c0.png

    We are ready to create our first custom map feature.

    Create a new Shapefile

    Before you can draw custom map features, you need to create a vector dataset to add it to. In our case, we will create a new feature rather than editing an existing dataset. Therefore, we need to define our own new dataset first.

    1. Create a new Shapefile layer from Layer > Create Layer > New Shapefile Layer...

       

      newshape_0.png.23ef3be158a74c940f6cbceb9a63711d.png

       

    2. You are presented with the following dialog:

       

      createshape_0.png.6cedb7a3058368308febde882dc7e327.png

    3. Name your Shapefile
    4. Set the geometry type. In this example we are going to create new features which describes geographical areas. For such features, you need to create a Polygon geometry type.
    5. Next there is a collection of fields grouped under the Fields list. By default, a new layer has only one attribute, the ID field. However, in order for the data to be useful, you actually need to say something about the feature you create in this new Shapefile layer because this what you will use in Spotfire to match it with your data. For our current example, it will be enough to add on field called "Name".
    6. Click OK to save.

    Your new Shapefile was added to the Layers panel. We can now draw map features into it.

    Draw map features

    By default, QGIS Layers are locked so we need to enable editing our Shapefile.

    1. Pan and zoom the map to the geographical area of interest.
    2. Right click the Shapefile layer you just created from the Layers panel and select Toggle Editing

       

      edit_2.png.c3564c24e759fc62adc05ee17ccd17e2.png

    3. Enable adding map features from Edit > Add Polygon Feature

      addpolygon_0.png.2f7ec4c61e8f058c76fbe71618c24418.png

    4. Start creating a map feature directly from the Map view by clicking on the map for each point you wish to include in your polygon.

      draw_0.png.72c11119d621b558fcf001f838e1ee62.png

       

    5. Once your done drawing your first map feature, right click anywhere on the Map view to finish.
    6. The attribute dialog is presented. Input a unique id and a name for your polygon and click OK to save.

      drawn_0.png.645e27e8f99f8aedf2180cec52864a5a.png

       

    7. Replicate this process to create all additional polygons you need in this same Shapefile.

    For this example we created 3 polygons in the same Shapefile layer to represent the southern, northern and eastern areas.

    feature_0.thumb.png.826dc2b2c6f71be07cef111793205f06.png

    We are ready to use this Shapefile in Spotfire. Lets export it to a workable file.

    Export as Shapefile to use in Spotfire

    Now that we created our custom features in QGIS, we need to export the Shapefile layer for use in Spotfire.

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

      save_0.png.f5f638d8bc1bcc1c9d5b6db1ab299113.png

    2. You are presented with the following dialog:

      savefin_0.thumb.png.cf61dcc678a575ae4d4048b0aa69ea7d.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 default CRS for Layers is EPSG:4326 - WGS 84. Lets select this CRS for your new Shapefile.
    6. Click OK to save. You new Shapefile is ready to use in Spotfire

    You can now launch Spotfire, open your Shapefile and create a Map chart to visualize to visualize your custom Shapefile.

    screen_shot_2018-03-15_at_09_02_16.thumb.png.1fb3e34d776a912fa47ab2d09cad1927.png


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...