5

As the title says: a simple question!

Can a valid shapefile have polygons that overlap each other? Or would they need to be in separate shapefiles?

I have Googled for the answer, but with no success...

UPDATE: Found the shapefile technical description, which says "Shapefiles handle single features that overlap or that are noncontiguous". Though I find that ambiguous as to whether that means a single self-overlapping feature, or single features that overlap each other, so my question stands.

1
  • There's no sense in any of this, so don't worry that you're missing anything. No one really sticks to the shapefile standard, strictly it's longlat only, and multipolygons are ambiguous about holes. The simple features standard aimed to clean up but remains ambiguous and unfinished also. What we have is a zoo of legacy implementations and fragmentation, every corner plagued by similar confusions.
    – mdsumner
    Apr 26, 2017 at 5:04

2 Answers 2

10

Yes - there is no restriction on the actual shapes or positions of the polygons in a shapefile. The only real restriction is that you can't mix geometry types in a shapefile (so no points & polygons).

While it is good practice not to have self intersecting polygons in there I don't think the spec actually forbids it unlike some other formats.

3
  • 1
    While there isn't anything that prevents self-intersecting polygons, the spec does in fact forbid them, on page 9.
    – Vince
    Apr 25, 2017 at 13:16
  • 1
    Do you mean where it says "This means that a segment belonging to one ring may not intersect a segment belonging to another ring"? I take that to mean the outer ring of a polygon cannot intersect with an inner ring that defines a hole in that polygon. Not that rings in completely different polygons can't overlap. I thought the question referred to the latter scenario, though I could be wrong. Apr 25, 2017 at 14:33
  • Thanks. Yes I was asking about polygons that overlap each other, not self-intersecting polygons.
    – Richard
    Apr 25, 2017 at 15:09
3

Shapefiles do not impose topology/relationship rules on the shapes. The shapes can be overlapping or not - it doesn't matter. In general packages that read shapefiles don't care either, but the experience of editing/working with stacks of multiple overlapping shapes can get a bit confusing. In general for good data management if you are mixing types of things (eg soil types and zoning) use multiple shapefiles, but there is no technical limitation within the shapefile.

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.