15

This is related to determining the interior of a Polygon.

My difficulty is that if I specify a Polygon covering the Earth going from East to West, it will still have a boundary along the antemeridian, which would show up in azimuthal projections. For example, in GeoJSON:

{
  "type": "Polygon",
  "coordinates": [
    [[-180, -90], [-180, 90], [180, 90], [180, -90], [-180, -90]]
  ]
}

Is there a standard way to specify a whole-sphere Polygon, with no boundary?

I've thought about using an empty exterior ring:

{
  "type": "Polygon",
  "coordinates": [
    []
  ]
}

The logic being that I could specify further rings as holes to be punched into the whole-sphere Polygon.

Unfortunately, GeoJSON stipulates that LinearRings must have at least 4 points, so this would be straying from the specification. However, I'm still interested in understanding whether this approach is taken anywhere else.

4
  • In part the answer has to depend on the GIS. However, you're in trouble at the very outset: if the polygon has no boundary, then--without specifying additional information not present in the linestring--there is no way for the software to distinguish the entire sphere from the empty set. (Empty polygons have important uses, even though many GISes do not implement them or implement them incorrectly.)
    – whuber
    Commented Dec 7, 2012 at 20:03
  • 1
    Thanks. We decided to simply define our own object type "Sphere" to handle this situation, since an empty LineString would most intuitively represent the empty set. I think this is the best "answer" that you can really give to this question. Commented Dec 7, 2012 at 20:10
  • 2
    I think you could generalize your solution, Jason, at little cost and with some benefit. Since you're dedicating one bit to distinguish the empty set from the sphere, why not use that bit with every polygon to indicate its orientation? For nondegenerate polygons, it would indicate whether the inside of the polygon should be considered to be to the right or to the left while traversing its boundary. For degenerate polygons, it would indicate whether the boundary coincides with the polygon or the complement is intended. Now you always know where the inside is.
    – whuber
    Commented Dec 7, 2012 at 20:16
  • Good idea! In general we want to accept standard GeoJSON as input, though. The Sphere object is a bit of a special case, so we don't mind defining our own type, since it will hardly be used. For Polygons, we have decided to adopt an ordering convention (right-hand rule to be consistent with the ESRI spec.) Commented Dec 7, 2012 at 21:18

1 Answer 1

3

Since there doesn't seem to be a standard way to represent this somewhat rare situation of a polygon with no boundary covering the whole Earth, we decided to add our own {type: "Sphere"}, which has worked remarkably well for our purposes.

We decided not to use a Polygon containing an empty LinearRing, since this more intuitively represents an empty polygon and could easily lead to confusion and accidental creation of whole-Earth polygons.

1
  • Very useful, thanks!
    – jgphilpott
    Commented May 22, 2021 at 21:38

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.