I’ve been having an incredibly frustrating time uploading polygons to a collection with a 2dsphere index. I have been constantly running into Can't extract geo keys
errors on seemingly ‘clean’ polygons and I just can’t understand why. The example below shows one:
'Can't extract geo keys: { _id: ObjectId('63e519a25d8e3392b33c997e'), centroid: { type: "Point", coordinates: [ -1.20585, 50.800568 ] }, geometry: { type: "Polygon", coordinates: [ [ [ -1.208399, 50.800335 ], [ -1.208383, 50.800265 ], [ -1.208363, 50.800228 ], [ -1.208298, 50.800104 ], [ -1.208203, 50.799997 ], [ -1.208116, 50.799885 ], [ -1.20796, 50.799773 ], [ -1.207641, 50.799532 ], [ -1.207576, 50.799503 ], [ -1.207356, 50.799427 ], [ -1.207213, 50.799396 ], [ -1.207309, 50.801346 ], [ -1.207433, 50.801312 ], [ -1.207613, 50.801243 ], [ -1.207635, 50.801235 ], [ -1.208173, 50.800931 ], [ -1.20826, 50.800845 ], [ -1.208309, 50.800783 ], [ -1.208331, 50.800747 ], [ -1.208349, 50.800718 ], [ -1.208362, 50.800685 ], [ -1.208372, 50.80066 ], [ -1.208396, 50.800504 ], [ -1.208399, 50.800335 ] ] Edges 34 and 36 cross. Edge locations in degrees: [50.7999570, -1.2033620]-[50.7999550, -1.2033580] and [50.7999560, -1.2033600]-[50.8001420, -1.2031880]'
I have also uploaded the feature geoJSON to a Github Gist here. The marker you can see is one of the coordinates given in the ‘edge locations’ even though there isn’t even an edge over there!
Apart from helping me understand this error, is there a way I can flag these errors before I try to bulk upload them to our database? It’s very time consuming to create and clean these polygons everytime and only to realise there is a problem when uploading.