3

For a long time, I was wondering which GIS spatial vector data types does the enclosed polyline feature possess.

Somebody told me, that when polyline feature's last vertex meets the first one, e.g. their coordinates are identical, it is always a polygon. And it is actually true following basic logic.

This article (Vector vs Raster: What’s the Difference Between GIS Spatial Data Types?) says apparently the same

POLYGONS connect vertices and close the path

When you join a set of vertices in a particular order and close it, this is now a vector polygon feature. In order to create a polygon, the first and last coordinate pair are the same.


My question is simply by which means/conditions enclosed polyline feature will possess the polygon vector data type? Otherwise, why the error did not evoke when I enclosed polylines in GIS-software (e.g. QGIS, ArcGIS)?


QGIS

When I deploy a tiny example in QGIS I am getting not a wrong but probably not a proper output.

Let's assume we have six features in the polyline layer, see image below.

example1

When I execute a small query using a "Virtual Layer" through Layer > Add Layer > Add/Edit Virtual Layer...

SELECT p.id, ST_AsText(p.geometry)
FROM "polylines" AS p

I am getting the following output, where the first and last vertices are equal for a LINESTRING() object.

result1

Moreover, when I copy&paste the same feature into the polygon layer it will end up as a normal polygon object. Nevertheless, the same arrangement is applicable for normal polyline objects, where the last vertex will be connected with a first one, similar to MakePolygon() function, see image below.


ArcGIS

A similar case will arise when I accomplish this task in ArcGIS 10.5 Desktop Advanced.

Let's assume we have four features in the polyline layer, see image below.

example2

Using the ArcPy

for row in arcpy.da.SearchCursor("polylines_layer", ["SHAPE@WKT"]):
  print row[0]

I am getting the following output, where the first and last vertices are equal for several features

result2

3

Depends on the software.

If the start and end points of a polyline overlap, the polyline can either be seen as open or closed. Some software like AutoCAD can automatically close polylines allowing you to extrude them immediately in the z-direction to create a 3D polygon.

Other software like QGIS will see the same polyline as open (which may explain why you do not receive any errors) until the user chooses to close it by filling the area inside the perimeter of the polyline by tools/functions some of which you have described.


So with the statement you quoted (emphasis mine):

POLYGONS connect vertices and close the path

When you join a set of vertices in a particular order and close it, this is now a vector polygon feature. In order to create a polygon, the first and last coordinate pair are the same.

The term "close" means the start/end vertices are locked and a shape is created inside the polyline to fill the entire space - a polygon. Otherwise, it would still be a polyline.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.