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.
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.
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.
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