Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Importing shapefiles

How to import a shapefile

Overview

The shapefile format is a geospatial vector data format for geographic information system (GIS) software. The shapefile format can spatially describe vector features: points, lines, and polygons, representing, for example, water wells, rivers, and lakes. Each item usually has attributes that describe it, such as name or temperature.

The format defines the geometry and attributes of geographically referenced features in three or more files with specific file extensions that need to be imported into the same project workspace. The following are the three required files for Alloy:

  • .shp — The main file that stores the feature geometry; required.
  • .shx — The index file that stores the index of the feature geometry; required.
  • .dbf — The dBASE table that stores the attribute information of features; required.

There is a one-to-one relationship between geometry and attributes, which is based on record number. Attribute records in the dBASE file must be in the same order as records in the main file.

Uploading a shapefile

To upload a shapefile, locate the shp, shx and dbf files that make up the shapefile.

alt text

You can drag and drop the files onto your map and upload them to the Gateway, see Uploading files.

Once the files have successfully been uploaded you can create an import to load the shapefile.

Creating a shapefile import

To create a shapefile import, (see Importing data), use the following procedure:

  1. Select the Gateway module.
  2. Select Create import.
  3. Select the Custom option for a shapefile.

alt text

  1. Complete the following fields

    • Name field to identify the import item.

    • Files- when you select this field a dialog is displayed that lists all the uploaded files, see Upload files. Locate the three shapefiles that you uploaded and select Save.

  1. Select Create to display the import object in the Item details panel on the right.

alt text

If the initial creation of the import is successful it indicates that the import has been initialised.

  1. Select the more actions button from the action bar.

  2. Select the Configure button to display the Custom configuration page on the left.

alt text

Defining the destination

  1. Select step Destination, this displays the dialog that allows you to a select the following:

alt text

  • Design - this allows you to select the design to use when creating the object items defined in the shapefile (required).
  • Collection - this field displays the default collection when you have selected a design, you can change the collection if more than one is defined within the design (required).
  • Mode - this allows you to select the type of import (required):

    • insert - this option adds items
    • update - this option allows you to update existing items
    • merge - this option allows you to add new items and update existing items
    • replace - this option removes existing items and adds new items.
  • Item ids header - this allows you to select the header that identifies the item ids you want to supply for the items being created by the import (optional). It is useful if you are basing the import on data previously exported from Alloy, for example, in order to do item updates. If you do not specify it for a “replace” or “insert” import, Alloy will create new item ids automatically for the new items.
  1. Select Done when you have completed all the fields.

Defining attributes

  1. Select step Attributes, this displays the dialog that allows you to configure how the data maps to the item attributes.

    Alloy will map some or all of the data headers within the import data to attributes within the design. It indicates how many attributes it can match. Data that is mapped is included in the import.

alt text

  1. When you click on the notification the attributes are mapped. You can now map remaining attributes manually.

  2. Select Add attribute, this displays Add attribute page.

alt text

The following fields are displayed

  • Header - this allows you to select a header from the data.

alt text

  • Attribute - this allows you to map the selected header to an attribute.

alt text

  1. Select the Add button, when you have completed your selections.

    The mapped attribute is added to the list of attributes.

alt text

You can repeat the process for all the attributes you want to map.

  1. Select Done when you have completed mapping attributes.

Selecting the geometry

Once you have mapped all the required attributes you can now select the geometry of the shapefile objects:

  1. Select step Geometry, this displays the dialog that allows you to select the geometry type of the object in the shapefile. You will need to know this in order to select the correct type.

alt text

  1. Select the Type field to display a dialog that lists the available geometry types.

alt text

When you select a geometry type, the Geometry page changes to allow you to complete additional details about the geometry. The details that are required depend on the geometry type you select.

  1. Once you have selected the geometry type select Done.

Completing the import

The remaining steps and are optional and generally not required to complete a shapefile import.

You can now validate and commit the import, see Importing data. Once the imported objects have been successfully committed you can access them within Alloy. You can use the search panel to find the related design and the imported items.

You can also create a layer and style to view the imported items. You need to ensure that the style visualisation is set to Basic to view the shapes correctly.

alt text


Alloy is a Yotta Product
Yotta is a Connected Asset Management Software and Services company.
Our aspiration is to transform the management of the built world to create safer, cleaner and more sustainable places for everyone. Find out more about us here.