Scientific Explorations: In-Depth Studies
Analyzing Holistic Modifications in Attribute Field Structures: An In-Depth Research focused on GIS Data Management using SGIS Desktop software
Create attribute changes by changing not only the values, but the complete attribute field structure.
Published on 18.09.2023
The fundamental distinction between CAD and GIS data lies in the treatment of attributes, which encompass information associated with geometry. Throughout this discussion, we’ll refer to CAD and GIS data rather than files, as GIS data can comprise multiple files depending on the format.
In the CAD realm, popular software solutions like AutoCAD, MicroStation, and Bentley Map are prominent. These programs typically operate with proprietary formats stored in a single file. This file encapsulates element classes supported by the software. From a user’s perspective, the file contains geometric data along with various properties that users can manipulate, including layers, colors, line thickness, line types, and text object font attributes. Nevertheless, CAD data primarily emphasizes geometric aspects.
In contrast, within the GIS domain, attribute information carries equal importance alongside geometry. GIS data conventionally categorizes CAD elements into three core types: points, polylines or lines, and polygons.
When dealing with GIS data, we’re referring to the use of specialized GIS software to interact with data, enabling us to view, search, select, and make modifications. These modifications usually involve changes to both the geometry and attributes of the data. At times, users may find the need to adjust the structure of attribute data itself.
In this case study, we will dive deeper into the possibilities and methods for modifying the structure of attribute data using SGIS Desktop software, offering you a practical guide to these processes.
Modifying attribute structures in SGIS Desktop is accomplished through the “Attribute Fields” action. This action specifically pertains to the attribute structure of the active layer. When you initiate this action, it triggers the opening of a new form labeled “Field Properties,” and it automatically loads the attribute fields from the active layer into this form. This feature provides you with control and flexibility in managing your attribute data.
Alterations to a specific field involve defining both the existing field and the new field. These terms are crucial for preserving attribute data for the specific field in question.
In general, attribute modifications fall into two main categories: individual field changes and structural imports. This distinction helps ensure data integrity and accuracy during the modification process.
Modifying Individual Fields
Changing the properties of attribute fields/Editing Fields
When working with your attribute data, it’s essential to have the flexibility to modify specific fields. SGIS Desktop offers several actions to facilitate these changes while preserving your attribute information.
Edit: This action allows you to modify a field’s name, type, or width without losing any attribute data associated with it.
Add: If you need to introduce a new field to your attribute structure, the Add action is the way to go. It appends the new field to the end of your attribute structure. When using this action, you must provide information for all three properties: name, type, and width. If your new field is of the ‘string’ type, it will initially be empty. For ‘integer’ type, it will default to 0, and for ‘double’ type, it will be set to 0.00. If you’re working with ‘logical’ type, it will be marked as ‘F,’ and for ‘date’ type, it will have a default value of 0.00.
Insert: The Insert action inserts a new field before the selected row in your field table. Much like the Add action, you’ll need to fill in the three properties for the new field. The value for the newly created field will match that of a field created using the Add action.
Delete: To remove a field from your attribute structure, simply use the Delete action. This will delete the selected field from the field table.
To String: In cases where you need to change all fields to the ‘string’ type, the To String action streamlines this process, making it a one-step operation.
These field modification actions provide you with the tools needed to tailor your attribute data to your specific needs efficiently.
Compress Button: The Compress button remains engaged until you click it again. When it’s pressed, and you subsequently click the Save action, all string fields will be saved with a width matching the maximum string length within the corresponding string field.
Additionally, when you’ve singled out a particular field, you can right-click on the grid to access a pop-up menu. This menu provides the option to move the selected field either up or down in the field order. Alternatively, you can use keyboard shortcuts: Ctrl+U for moving up and Ctrl+D for moving down. These functionalities allow you to conveniently rearrange fields and adjust their sequence to suit your needs.
Modifying Individual Fields Through an Example
I begin by loading an SHP file and accessing its attributes for review.
As I require a different attribute structure, I navigate to Attribute Fields to inspect the current attribute setup of the active layer.
To achieve the desired attribute structure, I can make changes such as field deletion, rearrangement, or editing. This results in the following field structure:
To save these alterations, I simply click the Save button. I then exit the Field Properties form.
By clicking on Attributes, I can see the updated structure along with the saved data:
Finally, I save the modified SHP file on my disk, ensuring that all the changes are now permanently stored.
Importing Attribute Structure
The “Take Over” icon provides three specific actions for modifying the entire attribute structure. This feature offers a versatile way to import attributes in various ways, allowing you to adapt the structure to your specific needs.
From Another Layer
When selecting this option, a form will appear listing all the currently open layers in SGIS. You need to choose a single layer from which you want to import the attribute structure. This import process includes field name, type, and width. It’s essential to modify field names before initiating the transfer to ensure they align with the field names in the target layer. This step guarantees that when you save the imported structure, attribute data in fields with matching names before and after the transfer will be retained.
From String List
This action involves selecting a text file that contains field names, typically with one name per line. The key principle here is matching names. The field type is automatically set to ‘string,’ and you can specify the field width after selecting the text file. If you decide to change the field type for some fields later using the Edit action, you can easily do that as well.
From Text File First Row
When you need to perform a bulk merge of attribute data with the geometry of a specific layer, you should have a prepared text file containing field names in its first row. Ensure that the separator in the text file is a semicolon [;]. Next, select the text file with the attribute data, and the software will automatically generate field names based on it. The field type in this case is ‘string,’ and you can set the width after selecting the text file.
After making your selections, click the “Save” action, which will save the defined attribute structure and import data from the previous attributes.
It’s important to note that actions from the ‘single field change’ group and actions from the ‘structure import’ group should be separated by saving the attribute structure changes. By saving the structure changes, the software can compare fields before and after, allowing it to preserve data for recognized fields during subsequent saves.
Importing a Predefined Attribute Structure and replacing the Existing Layer's Structure with it –A practical example
In situations where you’re dealing with multiple SHP files or files in different formats that share the same structure as the previous example and require similar modifications, you have two methods at your disposal. You can either follow the same approach as in the previous example or opt for an alternative by importing the structure from another source. I will now explain these two approaches in detail.
Method 1: Importing Structure from Another Layer or GIS Data Source
This method allows you to import the attribute structure from another layer or a different set of GIS data:
For this option, make sure you have both the active layer you want to modify and the data that serves as a template loaded into that layer.
Then, click on the “Take Over” button and choose the “From Another Layer” option:
The result of the action is the following:
Upon reviewing the attributes, you’ll be able to observe the outcome applied to the data.
Method 2: Importing Structure from a text file
Another way to import attribute structure is by choosing a text file containing field names:
The result of the action is as follows:
Saving your changes is essential to ensure the preservation of the new structure. It’s important to understand that every field in the text file, which matches a field name in the layer’s existing structure before this action, is considered an existing field. Any field not found by name in the existing structure is treated as a new field. All data from the existing fields will be retained during this process.
To see the outcome of this action, you can review the attribute data:
SGIS Desktop allows you to make extensive changes to the attribute table structure while safeguarding all existing data in the fields, even if fields have new names, types, or widths.
This includes the ability to edit any of the three properties of each field, add new fields, insert new fields, delete fields, rearrange field order, and import an entire structure from other sources like another layer or a text file. This flexibility empowers you to tailor your attribute data to your specific needs.