[DOCS-1391] 2dsphere bounding polygon must be <= hemisphere Created: 13/Apr/13  Updated: 30/Oct/23  Resolved: 16/Apr/13

Status: Closed
Project: Documentation
Component/s: Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Improvement Priority: Major - P3
Reporter: Daniel Pasette (Inactive) Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-9346 Cannot query world with 2dsphere index Closed
Participants:
Days since reply: 10 years, 44 weeks, 1 day ago

 Description   

See: https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/D7ZMWdUnR5U

If the x-axis spans more than 180° it is an invalid shape for $geoWithin or $geoIntersects.

For example:

// This is valid:
db.features1.find( { loc : 
  { $geoIntersects : 
    { $geometry : 
      { type : "Polygon" , coordinates: [ [ [1, 90], [-179, 90], [-179, -90], [1, -90], [1, 90] ] ] } 
    } 
  } 
} )

// This is invalid (and will silently return no results):
db.features1.find( { loc : 
  { $geoIntersects : 
    { $geometry : 
      { type : "Polygon" , coordinates: [ [ [2, 90], [-179, 90], [-179, -90], [2, -90], [2, 90] ] ] } 
    } 
  } 
} )



 Comments   
Comment by auto [ 16/Apr/13 ]

Author:

{u'date': u'2013-04-16T16:15:45Z', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1391 hemisphere limitation for spherical geo queries
Branch: master
https://github.com/mongodb/docs/commit/65564680763b62e1699833fb23e2a39adcf2c2aa

Comment by Daniel Pasette (Inactive) [ 16/Apr/13 ]

schwerin claims that there is a convention for how to handle large polygons based on the order in which you "walk" the coordinates. For example, if you walk the coordinates in a clockwise direction, everything on your "right" would be inside the polygon. GeoJSON explicitly shies away from dictating this directly. See this thread: http://lists.geojson.org/pipermail/geojson-geojson.org/2007-October/000273.html

Neither SQL Server nor PostGIS handle > 180° bounding polygons. aka, the "hemisphere limitation"

Comment by Daniel Pasette (Inactive) [ 15/Apr/13 ]

As a further tool that we may want to consider including in our documentation to illustrate how great arcs work when you create a bounding polygon. It was instructive to me how these look transposed onto the globe by this great circle rendering site. If the polygon is greater than 180° of long, we have no way of knowing which "side" the polygon is trying to describe and GeoJSON has no way to denote this – GeoJSON doesn't have support for "orientation" (E,N,S,W).

Note how this very "broad" (179° of long) poly renders:
http://www.gcmap.com/mapui?P=0W2N+-+179W2N+-+179W2S+-+0W2S+-+0W2N

vs. a polygon that could be thought of as extending beyond 180° (it doesn't :
http://www.gcmap.com/mapui?P=2E2N+-+179W2N+-+179W2S+-+2E2S+-+2E2N&MS=wls&DU=mi

Hope this helps.

Generated at Thu Feb 08 07:40:55 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.