[SERVER-9240] Exterior shell of polygon is invalid: duplicate points not ignored in Polygon/MultiPolygon Created: 04/Apr/13  Updated: 11/Jul/16  Resolved: 11/Oct/13

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: 2.4.1
Fix Version/s: 2.5.3

Type: Bug Priority: Major - P3
Reporter: Brian Britten Assignee: Daniel Pasette (Inactive)
Resolution: Done Votes: 2
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Single MongoDB instance running on Window laptop.


Attachments: File MultiPolygonSample.json     Text File SamplePloygons.txt    
Issue Links:
Depends
Related
related to SERVER-9401 GeoJSON Parser: Can't extract geo key... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

When trying to add a GeoJSON polygon to a field with a 2dsphere index I get the error: "Exterior shell of polygon is invalid".

That same GeoJSON polygon appears to be vaild when tested at http://geojsonlint.com/.

How can I identify why the shell is invalid?
The Attached file contains both the invalid polygon and a valid one that stored successfully.



 Comments   
Comment by auto [ 10/Oct/13 ]

Author:

{u'username': u'monkey101', u'name': u'Dan Pasette', u'email': u'dan@10gen.com'}

Message: SERVER-9240: ignore duplicate points in Polygon/MultiPolygon
Branch: master
https://github.com/mongodb/mongo/commit/84e1053cc47db7fe49692e3d9adb295da035511d

Comment by Daniel Pasette (Inactive) [ 02/Sep/13 ]

Thanks for the report.
This was only fixed for type LineString in SERVER-9401 and needs to be extended to the other types.

Comment by Olaf Krische [ 02/Sep/13 ]

Not working MultiPolygon

Comment by Olaf Krische [ 02/Sep/13 ]

I can verify that error with Mongo 2.5.1 and 2.5.2, though using a MultiPolygon (MultiPolygonSample.json)

The MultiPolygon only consists of one Polygon. And the polygon only has one linear ring with 75 points. First and last point are the same.

Then i continously removed points from the end (except for the last).

When there are only points 49 left ( i removed [13.6939, 51.0979] ), then i was finally able to save the sample.

Comment by Brian Britten [ 05/Apr/13 ]

In reviewing the points further, the last point and the second to last point in the polygon are the same. After removing the duplicate point the GeoJSON saved correctly.

Should the GeoJSON be invalid if it contains a duplicate point?

Generated at Thu Feb 08 03:19:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.