2

I have this file nuts0.json that I would like to change by removing some countries like Iceland. To do this, I used the method I found in this post. Then I coverted the GeoJSON file to TopoJSON using mapshaper.

It works but the countries that have the islands (such as France, Italy, UK, etc.) are divided.

Let me explain better, when I do a visualization using the original file and move the mouse over Italy, I get this:

enter image description here

When I do the same thing using the modified file with QGIS, I get this:

enter image description here

These are the files:

As you can see, here are the two pieces of code that are different:

nuts0.json:

{
    "arcs": [[[81, 82, -63, -24, -4]], [[83]], [[84]]],
    "type": "MultiPolygon",
    "properties": {
        "nuts_id": "IT",
        "name": "Italy",
        "population": 59685227
    },
    "id": "IT"
}

nuts03.json:

{
    "arcs": [[66, 67, -53, -19, -4]],
    "type": "Polygon",
    "properties": {
        "id": "IT",
        "nuts_id": "IT",
        "name": "Italy",
        "population": 59685227
    }
}, {
    "arcs": [[68]],
    "type": "Polygon",
    "properties": {
        "id": "IT",
        "nuts_id": "IT",
        "name": "Italy",
        "population": 59685227
    }
}, {
    "arcs": [[69]],
    "type": "Polygon",
    "properties": {
        "id": "IT",
        "nuts_id": "IT",
        "name": "Italy",
        "population": 59685227
    }
}

How can I solve?

  • 2
    In QGIS, go to Vector | Geometry Tools | Singleparts to multipart. Select id (or nuts_id) as Unique ID field. – Kazuhito Feb 24 '18 at 18:49
  • you should add this as an answer @Kazuhito – pLumo Feb 26 '18 at 10:28
1

The modified layer nuts03.json has Italy as a set of three parts. Each part is represented as a separate record in the attribute table. This is so-called Single parts.

enter image description here

Singleparts to Multipart tool can put them into one collection of features (Multi part geometry).

enter image description here

3

You can use the use the Delete Part function from the Advanced Digitizing Toolbar to manually delete only parts of countries which have multiple separate polygons.

Probably you have to activate the toolbar first under View > Toolbar > Advanced Digitizing Toolbar. After enable editing for your layer, you can choose the function Delete Part which is highlighted in the following screenshot:

enter image description here

Now simply select all areas you want to delete and save the file when you are finished. Now all original multipart objects stay intact and the highlighting works as expected.

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.