[SERVER-15388] find 'big polygon' geo objects after the 2.8 release Created: 24/Sep/14 Updated: 06/Dec/22 Resolved: 14/Feb/20 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Geo |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Quentin Conner | Assignee: | Backlog - Query Team (Inactive) |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Assigned Teams: |
Query
|
||||||||||||
| Participants: | |||||||||||||
| Description |
|
It would be nice for GEO queries to find stored Big Polygon documents, after the 2.8 release that allows $geoWithin and $geoIntersect queries that reference Big Polygon GeoJson objects. Big Polygon means a polygon with area larger than one hemisphere. The following mongo shell script would work with the feature addition.
|
| Comments |
| Comment by Eric Sedor [ 14/Feb/20 ] | |
|
This request is now tracked by SERVER-45189. Please watch that ticket for updates. | |
| Comment by Siyuan Zhou [ 13/Oct/14 ] | |
|
SERVER-15626 has been filled to support longitude of -181. Thank you for pointing out this issue. However I don't think it will come with 2.8. Please follow that ticket to track its status. Just to make it clear, rendering this polygon is actually a problem of map projection. Leaflet and Google Map use EPSG:3857 projection, which allows longitude like -181. Map projection is used to display the shapes on the earth, defining how to represent, for example, a point (longitude -181 and 179 are different), a line (the straight line on the map) and a polygon (the area bounded by lines defined above). They are fundamentally different with the model WGS84 used by MongoDB and GPS, which is used to define the shapes on the earth. In WGS84, longitude -181 and 179 are the same and a line is defined by the shortest path on the earth (maybe a curve on the map). This is why your polygon is not a big polygon in the ticket's context, regardless of the map projection. Since there are so many different kinds of map projection (See D3 Geo Projection), it is impossible for us to support all of them, but we can definitely make using the most common projections easier, like the above SERVER-15626. Thanks, | |
| Comment by Franck Lahaye [ 08/Oct/14 ] | |
|
Siyuan, Is the support for the extended range of values (>180 and <-180) planned for mongodb 2.8 ? Changing my longitude values from -181 to +179 is rendering a big polygon using librairies like leaflet (not the smaller one as mongodb assumes). Thank you for your precious help, | |
| Comment by Siyuan Zhou [ 08/Oct/14 ] | |
|
Longitude -181 is actually +179, so replacing -181 with 179 should work for you. We understand that some libraries allow longitude to be less than -180 or greater than 180, but MongoDB doesn't support that yet. Unfortunately, GeoJSON only defines the syntax of a geometry and some part of the semantic (like the ordering of longitude and latitude). The range of values is not defined in GeoJSON and depends on implementations. The lack of semantic definition is also a reason for this big polygon feature - which side of a polygon on the earth should be the inside? Without "big polygon", we usually assume the smaller one is the inside. Currently building a 2dsphere index is a way to ensure the correct geometry format. Thanks, | |
| Comment by Franck Lahaye [ 08/Oct/14 ] | |
|
Hi Siyuan, So the only solution would be to split the polygon in 2 distinct features to perform the geoIntersect query ? Do you know where I could find the specification for a correctly formed geojson ? I did not see a reference to it on geojson.org. Best, | |
| Comment by Siyuan Zhou [ 08/Oct/14 ] | |
|
Hi FranckL, Thanks for your question. Yes, it is normal and it's not relevant to the "big polygon" feature. The given GeoJSON document is considered malformed since the longitude is greater than 180. When answering the above query, MongoDB doesn't understand the document and ignores it silently to respect “schemaless” style. This can be proved by building a 2dsphere index on "features.geometry". MongoDB will return an error when building 2dsphere index for malformed geometries.
| |
| Comment by Franck Lahaye [ 08/Oct/14 ] | |
|
Hi Greg, Could you please consider the following query and GeoJSON : } { } The polygon is smaller than an hemisphere but the query returns no results. Is it a normal behaviour ? if the polygon is smaller than an hemisphere (or less than 180° of long according to https://jira.mongodb.org/browse/DOCS-1391?jql=text%20~%20%22hemisphere%22) mongodb should not have an issue, correct ? Thanks | |
| Comment by Greg Studer [ 25/Sep/14 ] | |
|
There's two big issues here - the first is that no other application will understand the CRS of these objects, and so this encourages users to store GeoJSON data in an incompatible way. The other problem is that we need to come up with rules regarding how different CRSes are stored and queried in MongoDB - right now we have a lot of inconsistency here. |