Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Topojson - Arcs for Singapore and Hong Kong

I noticed world-110m.json and world-110m2.json at https://github.com/mbostock/topojson/tree/master/examples didn't have the paths for Singapore and Hong Kong. I looked in the Natural Earth data set that generates the world-110m.json file, and noticed that Singapore was listed in the tiny_countries file, but only as a point, not as a polygon. The normal countries file does not appear to include Singapore. However, notice on http://techslides.com/d3-world-maps-tooltips-zooming-and-queue/ that Singapore is not a point, but a path.

I notice that the above link has paths for Singapore and Hong Kong. However, I'm having some problems using the files from that page because of some complicated code and would prefer to insert the arcs manually.

Thanks!

like image 493
Drew Avatar asked Oct 30 '14 14:10

Drew


People also ask

What are TopoJSON arcs?

Arcs — or sequences of points which can then be used to define line strings and polygons — can be referenced numerous times by different shapes within the file, and therefore greatly decrease data redundancy and the overall size of TopoJSON files. This format's use of arcs set the TopoJSON apart from other GIS formats.

What is TopoJSON data?

TopoJSON is a JSON format for encoding geographic data structures into a shared topology. A TopoJSON topology represents one or more geometries that share sequences of positions called arcs.


1 Answers

ok, found a solution to this 💡

1) get this specific admin-0 countries shapefile zip from natural earth Admin - 0 Countries | Download countries https://www.naturalearthdata.com/downloads/10m-cultural-vectors/

2) upload that 5mb ne_10m_admin_0_countries.zip shapefile zip you downloaded from Natural Earth to https://mapshaper.org/

enter image description here

use the mouse to drag and the scroll wheel or the plus button to zoom and notice that both Hong Kong and Singapore exist as shapes/polygons in this shapefile:

Hong Kong

Hong Kong

Singapore

Singapore

3) in mapshaper, click simplify and then check prevent shape removal in the simplification menu that pops up

enter image description here

4) simplify your geography and then export it to topojson. 1% simplified is close to the ~500k filesize of the original world-110m2.json file (edited) the resulting "whole worth with shapes preserved for tiny countries" topojson files that I came up with are shared in this github reposititory https://github.com/micahstubbs/tiny-countries-geo/tree/master/out

files

like image 72
Micah Stubbs Avatar answered Sep 21 '22 23:09

Micah Stubbs