I wanted to display polygon data for each country in Mapbox.
The data creation at that time is summarised below.
The final colour-coded map will be based on the survey statistics on the number of Japanese nationals residing abroad.
Get polygon data for each country.
World map data can be downloaded from https://www.naturalearthdata.com
The site is licensed for use in all types of projects by a number of volunteers.
It also provides map datasets available at scales such as 10m, 50m, etc., with vector and raster data available. It could be used for a variety of purposes.
Download page
Go to page.
https://www.naturalearthdata.com/downloads/
There are several scale accuracies available, but in this case 50 m is selected.
Click on ‘Cultural’.
You will be redirected to the vector data download page.
As detailed properties are not required, click on ‘Download countries’ under ‘Admin 0 – Countries’.
A Zip file will be downloaded. Unzip to obtain the shp file.
Convert shp files to GeoJSON file format.
I use the https://mapshaper.org/ website.
When accessed, the user is prompted to specify import files.
Drag and drop the shp file you have just solved here.
The polygon data of the world map will appear.
Click ‘Export’ in the top right-hand corner. In the dialogue box that appears, select ‘GeoJSON’ and click ‘Export’.
You can now get a locally converted JSON file. Easy.
About the shp file to be uploaded
When dragging and dropping shp files, select and upload .shp, .dbf, .shx, .cpg and .prj files together.
The .shp file has graphic information, so it will be displayed on its own, but it does not have a coordinate system or GIS data. When deploying on another map service, it is often difficult to find the coordinate system (it may be slightly off…). It is possible).
.shp | Stores graphic information. |
.dbf | Stores attribute information. |
.shx | Stores index information. |
.prj | Stores coordinate systems (e.g. Japanese geodetic system, world geodetic system, etc.). |
.cpg | Stores character codes for attribute information. |
About attribute information in .dbf
This blog uses the https://mapshaper.org/ website for conversion.
This is synonymous with uploading .dbf attribute information to an external server.
If you are dealing with personal or confidential information, do not use it. (This can lead to information leaks.)
About the licence
No permission or author credit is required to use Natural Earth!
They waive all financial rights to the map, and it is OK to use it for commercial purposes.
Happy mapping!
Enjoy the mapping! said. Thank you very much.
Summary
I miss working with ESRI’s ArcGIS. I used to import shp files into geodatabases, convert raster data and it brings back memories.