1

I have a GeoJSON which is a list of Polygon and MultiPolygon features, one at each line. Each feature takes the following form:

{"geometry": {"type": "MultiPolygon", "coordinates": [[[[-61.686668, 17.024441000000138], [-61.73805999999996, 16.98971899999998], [-61.82916999999992, 16.996944000000042], [-61.87611399999997, 17.016941000000088], [-61.88056199999994, 17.019721999999945], [-61.883613999999966, 17.02360900000008], [-61.88583399999999, 17.028053000000057], [-61.88722200000001, 17.033054000000106], [-61.89111299999996, 17.094165999999973], [-61.88722200000001, 17.10527399999995], [-61.88417099999998, 17.10972199999992], [-61.832779000000016, 17.16388699999999], [-61.826392999999996, 17.167220999999984], [-61.794448999999986, 17.163330000000087], [-61.78417200000001, 17.15833299999997], [-61.74417099999994, 17.13721799999996], [-61.674171, 17.09360900000007], [-61.670279999999934, 17.090275000000076], [-61.66889200000003, 17.084998999999982], [-61.66638899999998, 17.04583000000008], [-61.667502999999954, 17.040553999999986], [-61.682503, 17.027495999999985], [-61.686668, 17.024441000000138]]], [[[-61.72917199999995, 17.608608000000004], [-61.73111699999998, 17.54722200000009], [-61.73277999999999, 17.541111], [-61.738891999999964, 17.5405540000001], [-61.75194499999992, 17.549442000000056], [-61.81555899999995, 17.583885000000066], [-61.834723999999994, 17.58860800000008], [-61.83944700000001, 17.58666599999998], [-61.842781, 17.582775000000083], [-61.84750399999996, 17.580830000000105], [-61.853057999999976, 17.58305400000006], [-61.856674, 17.592498999999975], [-61.87389400000001, 17.688889000000017], [-61.87528199999997, 17.69860799999998], [-61.873062000000004, 17.703888000000063], [-61.85028099999994, 17.722775000000127], [-61.84555799999998, 17.724998000000028], [-61.83917199999996, 17.724720000000104], [-61.787223999999924, 17.700554000000068], [-61.78361499999994, 17.697220000000073], [-61.74333999999993, 17.653053], [-61.740279999999984, 17.649166000000093], [-61.73805999999996, 17.644722000000115], [-61.73167399999994, 17.624996000000067], [-61.72917199999995, 17.608608000000004]]]]}, "type": "Feature", "id": "0", "properties": {"SUBREGION": 29, "NAME": "Antigua and Barbuda", "AREA": 44, "ISO2": "AG", "13sum": 5484.390009230003}}

If I import it into QGIS only the first feature (line) is read. Thus, I suppose I should combine everything into a single Featurecollection which can be then converted into a shapefile. How do I do this?

1

You just need to plug your geojson features into the features array of a FeatureCollection:

{
    "type": "FeatureCollection",

    "features": [       

    ]
}

And if your list of GeoJson features aren't separated by a comma, you'll need to add that in yourself. A text editor will do the trick (or you could script it). Here's a screenshot of what I use in Notepad++:
enter image description here

{
    "type": "FeatureCollection",

    "features": [{
            "geometry": {
                "type": "MultiPolygon",
                "coordinates": [[[[-61.686668, 17.024441000000138], [-61.73805999999996, 16.98971899999998], [-61.82916999999992, 16.996944000000042], [-61.87611399999997, 17.016941000000088], [-61.88056199999994, 17.019721999999945], [-61.883613999999966, 17.02360900000008], [-61.88583399999999, 17.028053000000057], [-61.88722200000001, 17.033054000000106], [-61.89111299999996, 17.094165999999973], [-61.88722200000001, 17.10527399999995], [-61.88417099999998, 17.10972199999992], [-61.832779000000016, 17.16388699999999], [-61.826392999999996, 17.167220999999984], [-61.794448999999986, 17.163330000000087], [-61.78417200000001, 17.15833299999997], [-61.74417099999994, 17.13721799999996], [-61.674171, 17.09360900000007], [-61.670279999999934, 17.090275000000076], [-61.66889200000003, 17.084998999999982], [-61.66638899999998, 17.04583000000008], [-61.667502999999954, 17.040553999999986], [-61.682503, 17.027495999999985], [-61.686668, 17.024441000000138]]], [[[-61.72917199999995, 17.608608000000004], [-61.73111699999998, 17.54722200000009], [-61.73277999999999, 17.541111], [-61.738891999999964, 17.5405540000001], [-61.75194499999992, 17.549442000000056], [-61.81555899999995, 17.583885000000066], [-61.834723999999994, 17.58860800000008], [-61.83944700000001, 17.58666599999998], [-61.842781, 17.582775000000083], [-61.84750399999996, 17.580830000000105], [-61.853057999999976, 17.58305400000006], [-61.856674, 17.592498999999975], [-61.87389400000001, 17.688889000000017], [-61.87528199999997, 17.69860799999998], [-61.873062000000004, 17.703888000000063], [-61.85028099999994, 17.722775000000127], [-61.84555799999998, 17.724998000000028], [-61.83917199999996, 17.724720000000104], [-61.787223999999924, 17.700554000000068], [-61.78361499999994, 17.697220000000073], [-61.74333999999993, 17.653053], [-61.740279999999984, 17.649166000000093], [-61.73805999999996, 17.644722000000115], [-61.73167399999994, 17.624996000000067], [-61.72917199999995, 17.608608000000004]]]]
            },
            "type": "Feature",
            "id": "0",
            "properties": {
                "SUBREGION": 29,
                "NAME": "Antigua and Barbuda",
                "AREA": 44,
                "ISO2": "AG",
                "13sum": 5484.390009230003
            }
        }, {
            "geometry": {
                "type": "MultiPolygon",
                "coordinates": [[[[-61.686668, 17.024441000000138], [-61.73805999999996, 16.98971899999998], [-61.82916999999992, 16.996944000000042], [-61.87611399999997, 17.016941000000088], [-61.88056199999994, 17.019721999999945], [-61.883613999999966, 17.02360900000008], [-61.88583399999999, 17.028053000000057], [-61.88722200000001, 17.033054000000106], [-61.89111299999996, 17.094165999999973], [-61.88722200000001, 17.10527399999995], [-61.88417099999998, 17.10972199999992], [-61.832779000000016, 17.16388699999999], [-61.826392999999996, 17.167220999999984], [-61.794448999999986, 17.163330000000087], [-61.78417200000001, 17.15833299999997], [-61.74417099999994, 17.13721799999996], [-61.674171, 17.09360900000007], [-61.670279999999934, 17.090275000000076], [-61.66889200000003, 17.084998999999982], [-61.66638899999998, 17.04583000000008], [-61.667502999999954, 17.040553999999986], [-61.682503, 17.027495999999985], [-61.686668, 17.024441000000138]]], [[[-61.72917199999995, 17.608608000000004], [-61.73111699999998, 17.54722200000009], [-61.73277999999999, 17.541111], [-61.738891999999964, 17.5405540000001], [-61.75194499999992, 17.549442000000056], [-61.81555899999995, 17.583885000000066], [-61.834723999999994, 17.58860800000008], [-61.83944700000001, 17.58666599999998], [-61.842781, 17.582775000000083], [-61.84750399999996, 17.580830000000105], [-61.853057999999976, 17.58305400000006], [-61.856674, 17.592498999999975], [-61.87389400000001, 17.688889000000017], [-61.87528199999997, 17.69860799999998], [-61.873062000000004, 17.703888000000063], [-61.85028099999994, 17.722775000000127], [-61.84555799999998, 17.724998000000028], [-61.83917199999996, 17.724720000000104], [-61.787223999999924, 17.700554000000068], [-61.78361499999994, 17.697220000000073], [-61.74333999999993, 17.653053], [-61.740279999999984, 17.649166000000093], [-61.73805999999996, 17.644722000000115], [-61.73167399999994, 17.624996000000067], [-61.72917199999995, 17.608608000000004]]]]
            },
            "type": "Feature",
            "id": "0",
            "properties": {
                "SUBREGION": 29,
                "NAME": "Antigua and Barbuda",
                "AREA": 44,
                "ISO2": "AG",
                "13sum": 5484.390009230003
            }
        }

    ]
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.