In vector layers, different types of information are stored like:

  • Geoemtry
  • Attribute data
  • Meta data (like filename, projection etc.)
  • Spatial indices

However, what about topology? Is it an explicit type of information and stored as such in the underlying file or database? Thus something like: "feature no. 7 borders feature no. 6 starting from vertex 54 up to veretx no. 87, corresponding to vertices 103 to 136 of feature 6". Or is topology just an implicit information - one that is derived from the geometry of the features present - quite similar to the length of a line or the area of a polygon that can be deduced from the geometry, even if it is not stored as attribute.

As this question seems to be software specific, I am asking specifically about using Geopackage files in QGIS - however, every answer that addresses the general principles is welcome as well.


1 Answer 1


It depends totally on the software.

Back when I used Arc/Info v3 in the early 90s, all polygonal data was stored using "Arc-Node Topology". When ArcPlot needed to draw a polygon it looked up in a table to see what arcs made up that polygon, then looked up the coordinates in another table and drew the arc, in the right direction, to connect up the polygon.

The topology was thus explicit and you could test if a polygon bordered another polygon by seeing if they had the same arc in their arc table.

However starting with ArcView and Shapefiles, the predominant storage of polygons became the explicit storage of shapes themselves, and not component arcs with topology. A shapefile of polygons has any adjacent borders stored twice. To draw a polygon the software goes to the start of the polygon coordinates and connects the dots until its finished.

With this storage, to compute topology such as adjacency is more expensive since you have to work on the polygon node coordinates and do geometric operations (such as distances).

Topological data files (ie ones that represent data in an Arc-Node topology structure), such as topojson, when read into a Simple-features compliant software package (eg QGIS) will have to unwrap all the topology and build full polygons internally at some point. Whether this is done at "Load" time or "Oh I have to draw this polygon" time is again dependent on the TopoJSON driver.

  • Thanks a lot, at least it is now clear that different principles are used. Did I understand you right: Shapefiles do not store any explicit information about topology? When needed, to software used has to check the geometry to see what kind of topological relation is involved - did I understand that correctly?
    – Babel
    Feb 6, 2021 at 15:45
  • 1
    Correct. Shapefiles (of polygons) store each "ring" as a separate set of X-Y coordinate vertices. Adjacent polygons result in up to double the file size as the border coordinates will appear twice.
    – Spacedman
    Feb 6, 2021 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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