topojson / us-atlas

Pre-built TopoJSON from the U.S. Census Bureau.
https://observablehq.com/@d3/u-s-map
ISC License
859 stars 139 forks source link

Add/explain scale targets #24

Closed bhrutledge closed 7 years ago

bhrutledge commented 7 years ago

The current 10m/1:10,000,000 scale is great, but it'd be nice to have an option for higher precision, especially as a basis for generating TopoJSON for individual states.

This seems to be the result of quantization and simplification. So, changing:

        --no-pre-quantization \
        --post-quantization=1e6 \
        --simplify=7e-7 \

to:

        --no-pre-quantization \
        --post-quantization=1e4 \
        --simplify-proportion=.5 \

results in more precise TopoJSON. But, I don't understand how the first set of arguments was derived from a 1:10,000,000 scale, or what I'd have to do to precisely define, say, a 1m or 100k scale.

Apologies if this information is already available in the docs, or via links. I'm definitely a newbie in this area.

mbostock commented 7 years ago

The Makefiles are just a starting point and you’re expected to fork and modify them to suit your needs. The intent of this repo is to help you find geometry and learn how to use TopoJSON. The initial values were chosen somewhat arbitrarily for displaying static maps in a 960×600 pixel area, but with plenty of extra resolution for zooming in to show more detail (say to compare counties for a given state). For example, see http://bl.ocks.org/mbostock/4060606. The source data is 1:1,000,000 from the USGS.

If you want more detail in the generated TopoJSON file, you’ll want to pass a larger value to --post-quantization, not a smaller value. The wiki is a little out-of-date (in that it doesn’t distinguish --pre-quantization from --post-quantization) but see the TopoJSON Command Line Reference for details. Of course, better is to pre-project the geometry and then simplify to the resolution you need in pixels. But sometimes you want a dynamic projection or to know the geographic coordinates… so this is again just a generic starting point.

If you have more questions, I recommend Stack Overflow or https://gis.stackexchange.com/. I’m not always able to answer issues promptly (as evinced by my recent closing of unanswered issues).