[SERVER-53860] Can't extract geo keys: Duplicate vertices: 3 and 64 Created: 18/Jan/21 Updated: 27/Oct/23 Resolved: 20/Jan/21 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Geo |
| Affects Version/s: | 4.4.3 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Micha Wensveen | Assignee: | Edwin Zhou |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Operating System: | ALL |
| Participants: |
| Description |
|
I am trying to save a document to MongoDb with a geojson. But I get an error: Can't extract geo keys: ...... Duplicate vertices: 3 and 64 (see attachment for the full error) The geojson can be used in https://geojson.io/ and https://geojsonlint.com/ I added the geojson file. |
| Comments |
| Comment by Edwin Zhou [ 20/Jan/21 ] | |
|
When a 2dsphere index is specified for the field that stores GeoJSON documents, the coordinates of the polygon are validated as a loop before they are inserted. There can be no duplicate coordinates in a loop except for the first and last points (to close the loop). In the GeoJSON you attached, there are duplicate vertices in index 3 and 64 with the following coordinates:
You can suppress this error by removing the second to last vertex. https://geojson.io/ and https://geojsonlint.com/ are good for verifying the syntax of your GeoJSON, but they do not verify the validity of the set of points in the polygon as a loop. Please note that the SERVER project is for bugs and feature suggestions for the MongoDB server. As this ticket does not appear to be a bug, I will encourage you to ask our community by posting on the MongoDB Developer Community Forums for issues like this in the future. Best, |