سؤال

Question, trying to index and getting the following error:

"Exterior shell of polygon is invalid"

However, I've tested the JSON on http://geojsonlint.com/ and it works

Here's my JSON

{
    "type": "Polygon",
    "coordinates": [
        [
            [
                116.306655,
                39.984977
            ],
            [
                116.30673,
                39.984977
            ],
            [
                116.306734,
                39.98483
            ],
            [
                116.30667,
                39.98483
            ],
            [
                116.306678,
                39.984714
            ],
            [
                116.306384,
                39.984705
            ],
            [
                116.30638,
                39.984858
            ],
            [
                116.306193,
                39.984852
            ],
            [
                116.306198,
                39.984601
            ],
            [
                116.306031,
                39.984597
            ],
            [
                116.306031,
                39.984596
            ],
            [
                116.306031,
                39.984596
            ],
            [
                116.306023,
                39.984961
            ],
            [
                116.306082,
                39.984964
            ],
            [
                116.306082,
                39.985019
            ],
            [
                116.306655,
                39.985032
            ],
            [
                116.306655,
                39.984977
            ]
        ]
    ]
}
هل كانت مفيدة؟

المحلول

What version of mongodb are you running. If you are running 2.4, try upgrading to 2.6. I had the same error message with census tiger line data that I had converted to GeoJSON, and which I had also confirmed via jsonlint. I had been running the index on version 2.4. I upgraded to mongodb version 2.6, and that solved my problem. I was able to create a 2dsphere index and run geonear queries just fine after that.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top