Scientific Explorations: In-Depth Studies

A SGIS Case Study

How to Create GIS Data? [Geometry + Attributes]

Published on 13.09.2023

Facebook
Twitter
LinkedIn
Reddit
Print

Creating GIS data involves organizing spatial and related (meta) information effectively.

This process usually includes data about elements like points, polylines, or lines, which are defined by their coordinates in space, along with additional data known as attributes for each element. These attributes provide descriptive and other relevant information about each element. In essence, GIS data encompasses both the geometry of the elements and their associated attributes.

Data, as in data organization in GIS, can take the form of either a single file, or multiple files. ESRI’s SHP format, for instance, consists of several binary files that together make up a complete dataset. On the contrary, there are numerous formats where data is structured only within a Text-file, and as such – encompassing both geometry and attributes of the elements.

We would say that, Creating GIS data depends on the software you use for creation, its functionalities, and the specific format requirements of the format itself used for creating GIS data. The choice of data format is indeed significant during the creation process. For example, some text formats are very user-friendly, allowing you to create GIS data using a simple text editor or dedicated software designed for that specific GIS data format.

However, in practice, creating multiple GIS datasets with a large number of elements can be challenging and may pose data integrity concerns. That’s exactly why specialized GIS software is often preferred.

In this case study guide, we will outline methods for creating GIS data using SGIS Desktop software.

Creating GIS Data with SGIS Desktop

As mentioned previously, GIS data is a combination of geometry and attributes. Typically, the spatial geometry is created or obtained using CAD software, while attributes are usually organized in a tabular format.

The process of creating GIS data in SGIS Desktop involves loading the geometry and then connecting it with attribute data.

There are four methods for loading the geometry of elements:

  1. Loading existing GIS data.
  2. Importing the geometry of elements from a CSV file.
  3. Importing the geometry of elements from a CAD file in DXF format.
  4. Drawing elements manually.

To load attribute data, you can use the method of importing a CSV file containing the attribute data. We must note that all the methods mentioned here, also allow for the individual entry of attributes, which is useful when working with a small number of elements. In this text, we will explain how to enter attributes in bulk using the ‘Add Attributes’ method, enabling you to efficiently link them to the geometry of the layer.

Loading Existing GIS Data

This method involves loading the geometry of the elements, which implies that existing attributes will be replaced with different (desired) attributes, not only in terms of internal content, but also in the entire attribute structure. To do this, we use the ‘Add Layer…’ feature and select the existing GIS data. While applicable to all three types of elements, it’s most commonly used for polylines and polygons.

As an illustrative example, consider loading cadastral parcels. You may have a prepared text file with data on vineyards, vineyard types, planting years, average yields in kilograms per unit area, and other information you wish to associate with each parcel of interest! Typically, one of the fields in this text file serves as a unique identifier linking the geometry to the attributes, often the cadastral parcel number for example.

Further details on modifying the attribute structure and linking new attributes to the geometry will be explained later in the text.

Loading Geometric Elements through CSV Files

POINT:

When you’re importing data from a CSV file, and the geometry type is a point, the process includes loading both the geometry and attribute data. This is because each row in the CSV file represents a single point element. In this scenario, it’s a good practice to have the CSV file contain all the attribute data along with the coordinates for each point element. Essentially, the first row in the CSV file should list field names, separated by a delimiter, and all subsequent rows should contain values for these designated fields, also separated by the same delimiter.

Here’s an example of part of the CSV file structure for loading point elements:

Clicking the ‘Load’ button creates a point layer and loads the selected file as GIS data. To save the data from the GIS layer in the desired format, you can use the ‘Layer > Save As…’ action and choose the appropriate format.

POLYLINE / POLYGON :

When loading the geometry for polyline-type elements, it is essential that the CSV file contains, at a minimum, the following structure:

Please note that the first usual row with field Names is always optional, and you can also choose any character as the separator. Each vertex point of the polyline element should be on a separate line, with each point having a unique element identifier. The order of coordinates determines the topology of connectivity for the polyline or polygon.

CSV File for Polygons

The CSV file containing coordinates and topology for polygons closely resembles the one used for polylines, with the addition of an extra field called HOLE. The HOLE field is assigned a value of 1 when there are no holes in the polygon. For polygons with one or more holes, it is assigned values such as 2, 3, 4, and so on, each corresponding to a subsequent hole in the polygon.

Loading Process

To load data as polylines, make sure to select ‘POLYLINE’ under the ‘Type of geometry’ section. For loading polygons, choose ‘POLYGON.’ You can also customize the loading process by right-clicking in the grid or using the ‘Geometry Definition’ section.

Creating and Loading a Layer

By clicking the ‘Load’ button, you create a polyline layer and load the selected file as GIS data. In the following sections, we will explain how to connect the polyline or polygon layer with attributes.

Loading Geometric Elements via DXF CAD Files

This approach entails importing a DXF CAD file into SGIS Desktop. You can achieve this by using two key functions: ‘Load DXF’ and ‘Separate GIS Layer By DXF Layers.’

  1. The first action categorizes the elements within the DXF file according to their types.
  2. The second action then further separates these elements based on their DXF layers.

This process allows you to efficiently load and organize geometry data from DXF CAD files in SGIS Desktop.

Creating Elements (“Draw” Elements)

To create elements, you can work within the active layer or open a new one. This process involves placing points, either with or without the assistance of snapping. It’s particularly useful for drawing elements such as polylines or polygons.

Here’s how it works:

  1. Select ‘Pick Points’ to start the drawing process.
  2. Define all the vertex points of the element.
  3. Click ‘Add New Element.’ This action opens a new window displaying the element’s coordinates, which you can edit as needed, as it’s presented in a text editor format.
  4. On the second tab of the window, you can input attributes or leave them empty.

Finally, use ‘Add Element’ to add the newly created element to the active layer. This straightforward approach allows you to draw but also customize elements.

Connecting Attribute Data to Geometry

As mentioned earlier, we’ve covered the methods for loading the geometry of GIS data as SGIS Desktop layers. Now, the fun part! Let’s proceed with the essential step of linking attributes to this geometry, achieved through the ‘Add Attributes’ action.

Attributes are typically organized within a text file, arranged in a tabular format, and separated by common delimiters like [Semicolon | Space | TAB | Comma]. It’s crucial to ensure that the first row of this text file contains the field names for your attributes.

To clarify, these attribute data are usually prepared in advance using a text editor, spreadsheet software like MS Excel or LibreOffice, and then exported as a text file. This approach streamlines the process of combining attribute information with your GIS data.

I’d like to emphasize that the ‘Add Attributes’ action does not modify the existing attribute structure. If the number of fields, their order, or their names in the first row of the CSV attribute data file do not match the attribute structure of the layer, you will receive a notification of this inconsistency during the file loading process. In such cases, it’s crucial to pause the attribute addition process and, beforehand, adjust the attributes of the active layer using the ‘Attribute Fields’ function.

When you click on ‘Attribute Fields,’ it opens the ‘Field Properties’ window. Here, you have the flexibility to make necessary changes to the attribute structure of the active layer. To quickly align the layer’s attributes with those in the CSV attribute data file, you can use ‘Take Over > From Text File First Row’ or ‘Take Over > From Another Layer.’ The first option imports the order and field names from the text file but sets the field type as ‘string’ with a field width of 30 spaces. The second option imports not only the order and field names but also the field type, and the number of spaces, directly from the selected layer. This way, you can easily match your attributes for a smoother data integration process.

Connecting Attributes to Your Layer

Now that you’ve successfully aligned the attribute structure of your layer with the attributes in your file, you can proceed with the ‘Add Attributes’ action.

Here’s how to do it:

  1. Click ‘Open’ to select the text file containing your attributes. This will open the file in a text viewer.
  2. When you open the ‘Load Attributes and Link with Geometry’ window, it will provide information about the element type in your active layer.
  3. In the ‘Settings > Pairing Mode’ section, you have three options for linking the attribute data from the file with the elements in your active layer:

Same order: Select this option when the order of attributes in the text file matches the order of elements in your active layer. It’s a straightforward choice that doesn’t require additional settings. Click ‘Link’ to add the attributes to your active layer.

Point in Polygon: Choose this option when your active layer consists of polygons, and you have a separate point layer containing points that correspond to the polygons. Each point should align with a specific polygon, such as parcel numbers matching parcels. To set this up:

  1. Select the point layer in the ‘Point Layer’ field.
  2. Choose a field in the ‘Point Link Field’ that contains values corresponding to the attribute field in the text file.
  3. In the ‘Text File Settings > Data Link Field’ section, select the field from the text file that holds the same values as the ‘Point Link Field.’
  4. Click ‘Link’ to add the attributes to your active layer.

Pairing Fields: Opt for this option when you want to link attributes based on shared values between the active layer and the text file. Here’s how:

  1. Select a field from the active layer, ‘Geometry Link Field,’ which contains unique values.
  2. These unique values will be paired with the values in the chosen ‘Data Link Field’ from the text file.
  3. Click ‘Link’ to add the attributes to your active layer.

Important Note: When you use the ‘Add Attributes’ action or click the ‘Link’ button in the active layer, any existing values in the attribute table will be replaced with the attributes from the text file. Please keep this in mind while working with your data.

All the actions we’ve discussed will result in a layer that displays its geometry in the Graphics Window, and you can access and edit attributes by clicking on ‘Attributes.’

As a user, your final step is to save the layer with GIS data in one of the available formats in SGIS Desktop. To do this, go to ‘Layer > Save As…’. This allows you to preserve your work in a format that suits your needs.