In the GIS world, for most modern formats and Standards (e.g., Shapefiles, WKB/WKT, GML, KML, etc.), valid polygons need to have closed linear rings, which is a linestring of coordinates where the first point is a repeat of the last point. For example, a triangle requires four points (not three).

POLYGON ((10 20, 30 60, 50 20, 10 20))


Who started this convention, and why? Is it some legacy of pre-Shapefile storage? (like how MS Windows still uses 2-byte CR+LF newlines?) Other non-GIS standards (e.g. SVG) don't require this repetition to encode polygons.

3 Answers 3


That convention goes back to the surveying industry; which has a point of beginning. So you start at a point in space, and the last point you reference is your closing point. This way you have a closed object.

So to build a full COGO object you need to have a complete description of what is being described. Its more accurate than a assumed close.

  • 7
    As DEWright says, when you're surveying, you can ensure accuracy in your measurements if your start and end points are the same. It also allows systems to flag invalid polygons if they're not closed, rather than treating it as an autoclose polygon which would silently mess up things like area calculation. Commented May 27, 2011 at 0:27
  • 1
    Of course, formal map making and surveying has existed for much longer than computers and digital formats. I can also imagine a draftsperson inking out the outline of a polygon, and needing the last point to draw a closed linear ring.
    – Mike T
    Commented May 29, 2011 at 7:20

The criteria for valid polygons are defined in the OGC's Simple Feature standards document* adhered to by the majority of GIS software and spatial databases. The reasons for requiring the start points and end points to match are likely to relate to the topological concept of a closed set.

The rules for a valid polygon are:

  1. Polygons are topologically closed
  2. The boundary of a Polygon consists of a set of LinearRings that make up its exterior and interior boundaries
  3. No two Rings in the boundary cross and the Rings in the boundary of a Polygon may intersect at a Point but only as a tangent
  4. A Polygon may not have cut lines, spikes or punctures
  5. The interior of every Polygon is a connected point set
  6. The exterior of a Polygon with 1 or more holes is not connected. Each hole defines a connected component of the exterior.

Valid Polygons

Valid Polygons

Invalid Polygons

Invalid Polygons

**If the OGC actually had their standards documents available on the web rather than in downloadable PDFs that require clicking an agreement, then they may be read more often..*

  • +1 Good explanation, but could you tell me if this is a valid polygon? Commented May 27, 2011 at 14:13
  • 2
    @kirk this.isValid() = depends on the implementation, and how the polygon is represented...! barendgehrels.blogspot.com/2010/02/… Commented May 27, 2011 at 14:37
  • Great link. That might cause issues for someone migrating from Sql Server to PostGIS. Commented May 27, 2011 at 15:30
  • @Kirk it would have been nice if you showed how the rings are laid out; is it a "banana-like" list of coordinates with one outer ring or is it an outer ring with an inner ring that touches the outer ring at only at one vertex?. Even at that, the answer for your particular question is implementation specific. Check out Paul's notes on Polygon validity 2010.foss4g.org/presentations/3369.pdf Commented May 29, 2011 at 0:52

It also makes many algorithms easier if you don't have to worry about wrapping round to the beginning of the polygon again.


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.