Scientific Explorations: In-Depth Studies

SGIS Desktop Case Study: Converting 20,000+ Lines to Polygons in Just 0.7 Seconds with ‘Alto’ Algorithm

Published on 22.09.2023

Facebook
Twitter
LinkedIn
Reddit
Print

Creating Polygons from Lines - A Fundamental GIS Task

In GIS, polygons are a vital element, serving various purposes from delineating countries and regions to representing urban parcels and more. A polygon is essentially a closed polyline, where the starting and ending coordinates coincide.

For effective use, polygons should exhibit simplicity, meaning they should not have self-intersections. This quality ensures their accuracy and usefulness in geographic information systems.

Whether you’re defining administrative boundaries, forest areas, or urban features, understanding how to create polygons from lines is a fundamental skill in GIS.

Creating Polygons

In this text, “creating” pertains to the realm of CAD and GIS. To put it succinctly, We’ll outline how to generate GIS polygons as geometric entities using SGIS Desktop software.

If you’re looking to craft a single or multiple polygons, the “Load CSV Data” action can assist you in achieving this. This entails loading a text file with coordinates. It’s important to note that this text file should contain coordinates of intersecting points on the polygon, each linked to a unique polygon identifier and a hole number within the polygon. This process can be quite handy when working with geographical data.

When working with CAD software like AutoCAD or MicroStation, you often deal with lines that connect two intersecting points. It’s a straightforward method commonly used in CAD environments.

In this text, we’ll use an example of a cadastral municipality, consisting of two parts: a rural area (arable land) and an urban, populated section. For this illustration, we have exported two vector CAD files in DXF format:

  1. Ros_Rural.dxf
  2. Ros_Urban.dxf

These files contain various elements, including lines representing cadastral parcels, cadastral objects, contour lines, municipal boundaries, parcel numbers, and object numbers. To keep things organized, these elements are grouped into layers. This approach helps manage and work with the data effectively.

CAD Drawing of Cadastral Parcels – Rural Section of the Cadastral Municipality
CAD Drawing of Cadastral Parcels – Urban Area within the Cadastral Municipality.

Begin by loading the Ros_Rural.dxf file using the ‘Load DXF’ action. Next, use the ‘Separate GIS Layer By DXF Layers’ action to separate the DXF layers. The result will look like this:

To find out how many elements or lines are in the ‘polyline-Parcel_rural_line’ layer, perform the action ‘Selection > Select All.’

The image will show that there are a total of 20,640 elements or lines in the selected layer. Please note that selecting these elements is optional but can help you understand how many elements are used to create polygons.

Next, you’ll need to repeat the same process by loading the Ros_Urban.dxf file. This will yield the following result:

Similarly, you can perform the selection process to determine the number of elements, but this time, focus on the ‘polyline-Parcel_urban_line’ layer:

In the urban section of the cadastral municipality, there are a total of 9,074 lines. This information will be valuable for your further tasks.

The “To Polygons” action creates a polygon layer based on a line layer. To execute this, follow these steps on the active layer:

  1. Select the “polyline-Parcel_rural_line” layer from the layer list.
  2. Click “To Polygons,” which will open a new form.

In the “New Polygon Layer Name” field, you can either keep the default name (the name of the active layer) or provide a custom name for the new polygon layer.

You also have the option to check “Without Duplicate Line” to exclude duplicate lines from the polygon creation process. If you’re certain that the active layer doesn’t contain duplicate lines, you can leave this option unchecked.

Finally, click the “Conversion” button to create the polygons.

You’ll observe that this process is remarkably swift, generating polygons from 20,640 lines in just 0.704 seconds. Moreover, it can even form polygons with holes, and polygons within polygons, if applicable. This efficient polygon creation procedure is powered by SGIS’s proprietary algorithm, known as Alto.

I’m currently repeating the polygon creation process on the active layer, specifically polyline-Parcel_urban_line. This step will help us convert lines into polygons for the urban area.

These two procedures were carried out on the parcel line layers within both the rural and urban regions. I am now repeating the same process for the lines representing objects in both the rural and urban areas. Consequently, we have successfully generated four new layers:

  • Rural parcel layer
  • Rural object layer
  • Urban parcel layer
  • Urban object layer

These newly formed layers can be saved for future use in one of the formats provided by SGIS Desktop.

SGIS Desktop offers a swift process for creating polygon layers from line layers. This process ensures topological integrity and guarantees that you will have a polygon layer perfectly suited for all your requirements.