1

It's the first time I use a JSON file to create a map of Europe. I downloaded these two files:

The first represents the states, while the second represents the regions of each state. I use them both because when you click on a country, the map is zoomed and I show the regions of the chosen state.

What I would like to do now is remove some islands that do not interest me (those circled in red). enter image description here

How can I do that? Of course I want to remove them from both nuts0.json and nuts2.json.


UPDATE

These are the regions I would like to delete:

enter image description here

I was thinking of using mapshaper because it's online and it seems simple, but I can use any software to let me do what I want.

I didn't try to do anything because I don't know how to do, the only idea that comes to me is to edit the file by hand but this thing does not seem particularly intelligent, because I don't know how to change the arcs.

I would like to delete those circled. I have read somewhere that it is possible to establish a threshold, and to eliminate the smaller regions of this threshold. But there are regions (see Sardinia) that I care to keep and Sardinia is certainly smaller than the French Guaiana.

  • Do you want to use mapshaper or are you open to using some other software? Did you try anything already, what issues did you face. Why only the circled parts of France, Spain, and Portugal, do you want to remove all non-continental Europe outliers (there are some in the bottom right too). Please edit the question to add more detail – nmtoken Jan 14 '18 at 10:34
  • @nmtoken Thank you for your quick reply. I added some details. I hope it can be useful. – marielle Jan 14 '18 at 10:49
  • 2
    If you don't mind using other software, consider using QGIS and then following these steps: convert GeoJSON to Shapefile and then run the algorithm Multipart to singlepart. Then you can easily select only the polygons you want to keep, and save this as a new GeoJSON. – 15Step Jan 14 '18 at 11:43
  • @15Step Thanks for the advice. I downloaded QGIS but I didn't understand how to do what you tell me. Could you be more specific or link me something that explains it better? Thanks – marielle Jan 14 '18 at 16:21
  • I uploaded a description, hope that helps. There is no need to convert to a shapefile btw as I mentioned, you can run Multipart to singlepart directly on the GeoJSON. – 15Step Jan 14 '18 at 17:01
3

So here is one solution using QGIS 2.18:

1) Save GeoJSON from URL and open in QGIS
2) Run "Multipart to singlepart" on the GeoJSON
3) Select desired polygons
4) Export selection to a new GeoJSON Layer

Details:

Step 1: Save and download the GeoJSON layer from the URL (copy paste the data into a text editor and save as "nuts0.json"). Drag this file into QGIS and select OK to accept the CRS (EPSG 4647).

Step 2: Notice that after saving a new layer has been added to the Layers Panel. Select from the Processing Toolbox (press CTRL+Alt+T, if you don't see it) the algorithm Multipart to Singlepart and run it on the nuts0 GeoJSON:

enter image description here

Step 3: In the Layers panel, highlight the 'Single Parts' layer that was generated from the algorithm, and in the toolbar above click on Select Features by area or single click -> Select features by polygon:

enter image description here

Select the polygons (countries) that you want to keep and they will turn yellow. Zoom in to verify the result:

enter image description here

Step 4: Right-click the created "Single parts" layer in the Layers Panel and click "Save as" (same as in step 1), only this time make sure to Check "Save only selected features", and make sure the format is GeoJSON. Repeat the steps for the other GeoJSON (nuts2.json).

enter image description here Result:

enter image description here

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.