Open eric-brechemier opened 9 years ago
Am kicking myself for not including the script in this repo (in all likelihood I did it in-browser through a series of manual steps). A good introduction on how to generate GeoJSON (and TopoJSON) from .shp files downloaded from Natural Earth is Let's make a map. If you can't be bothered with gdal and all the nonsense that entails then mapshaper.org is a good bet - you can drag a shapefile into the window and it'll give you some GeoJSON. From there you only need to worry about projecting it to a set of x-y coordinates, for which d3 is your best bet (I believe the projection used here was Robinson, which the Guardian generally uses for world maps).
Hope this helps!
Thanks for the feedback! Do you remember, by any chance, from which Natural Earth data files you started?
So far, I had this simple process in mind: get the list of polygons for each country from Natural Earth data and convert it, in one or two steps, to SVG paths. But I am a bit lost between countries and states and units and subunits etc.
I have found this other source for the shapes of countries on WMO (World Meteorological Organization) website, which gives a list of polygons for each country:
https://www.wmo.int/cpdb/js/json/WMO_basemap.json in WMO Basemap https://www.wmo.int/cpdb/data
Is there something similar in Natural Earth data or is it a completely different kind of beast?
If you're rendering country shapes, you probably want cultural vectors, admin 0 (admin 0 is countries, higher numbers are smaller subdivisions). If it's a large map and size doesn't matter, go for the 10m version, but if speed and size are of the essence then try the 50m or 110m.
The WMO_basemap.json is in GeoJSON format, which d3 knows how to project to an SVG path. Natural Earth doesn't have anything like that, it only has shapefiles which must be converted to GeoJSON. But because they're much larger and more detailed you have a bit more control over the finished product
@Rich-Harris Thank you for your valuable advice. I now understand how Natural Earth data differs from the WMO data or data in your repository.
Also, I previously thought that the sqlite database was the source of the shape files, but your reference to gdal
pointed me to the right direction, which is the other way round: the sqlite database is exported from the shape files using ogr2ogr
from gdal package.
Hi, I am interested in rebuilding these JSON files from the source (I have downloaded the latest Natural Earth data in sqlite format).
Are you willing to share your scripts, or more details about the method you used?
At this point, I am a bit lost in the plethora of tables in the Natural Earth database.