The issue here is TopoJSON’s default quantization behavior; you need to increase the quantization precision if you want to preserve detail when zoomed in. Try -q 1e5
to increase the quantization factor from the default by 10, or -q 1e6
by 100.
The appropriate value of Q depends on the maximum effective size of your map and limited by the original precision of the geometry. Your map appears to have 11 zoom levels by powers of 2, so starting with the smallest size of 560×410 at zoom level 0, the effective size of the map at zoom level 10 is 573,440×419,840. If you want to maintain this precision, you will need Q = 1e6 (and a significantly larger TopoJSON file).
More details: the quantization factor Q determines the maximum number of differentiable points and defaults to 10,000. For best efficiency, Q should be a factor of 10 because digits are base-10 encoded in JSON. The default value is appropriate for displaying a map on a computer screen which typically has at most a resolution of 2,560×1,440 pixels, well under 10,000×10,000. (Q is an upper bound on differentiability; if points are not uniformly spaced, you may get fewer differentiable points.)
TopoJSON uses quantization to determine whether two points are coincident for the purpose of simplification. This is required because GeoJSON does not encode topology, and exact matches would be overly strict due to floating point error in GeoJSON coordinates. Also, quantization is a major factor in reducing the size of the TopoJSON encoding, especially in conjunction with the delta encoding.
Slightly related, here is an example of the Asia Lambert Conic Conformal projection used for Russia.
The short answer to your question is:
topojson \
-o world-110m.json \
-- \
land=ne_110m_land.shp \
states=ne_110m_admin_1_states_provinces.shp
This will produce a topology with "land" and "states" objects. You can omit the land=
and states=
if you'd prefer the objects to have the file names instead.
However, a couple gotchas to be aware of:
The Natural Earth 1:110M dataset for only includes the United States in the Admin 1 — States, Provinces download. The 1:50M resolution download adds Canada to this set, and the highest-resolution 1:10M download includes the entire world. So, if you want to make a world map, you’ll currently need the 1:10M dataset, which you can then simplify as desired. (Though the automatic simplification provided by topojson
won’t be as good as the hand-tweaked simplification done by Kelso et al. at Natural Earth.)
Only the 1:10M Natural Earth dataset is currently topologically-consistent. This means that there will be some cases where the borders won’t match up exactly between adjacent features in the 1:50M and 1:110M datasets. In practice, this usually isn’t a big problem, but it can prevent some topological algorithms from working perfectly, such as simplification and map coloring. So again, you may need to start with the 1:10M dataset and simplify.
Use additional options to topojson
to customize the generated TopoJSON file, such as including properties, increasing the quantization factor to improve accuracy, and enable simplification. There are many examples of converting Natural Earth data to TopoJSON in the world-atlas repository. See the Makefile for details if you want to customize how the TopoJSON is generated (e.g., combine different files, modify properties, change simplification thresholds). And lastly see the topojson
command-line reference for an overview of all the available options.
Best Answer
It's obvious here that you can't expect to get 200 MB from a server to a client in a reasonable amount of time.
Your only options are to drastically simplify it (probably will resulting unusable information) or tiling it (either vector or raster tiling should work).
What you do depends on what you know and what you want to achieve. Here's what I suggest, in order of easiness: