Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Hey, that's fantastic. Thank you for the feedback. I can see how you would need to raise TopoJSON's quantization level for creating zoomable geometry; the default level is designed for display approximately 10,000px by 10,000px, and you'd quickly exceed that if you allow people to zoom in. I probably wouldn't want to change the default, though, as that would make the files larger than necessary for static display. (Perhaps there's a way to decide the appropriate quantization automatically?)

A useful technique with zoomable geometry is using Visvalingam's algorithm to precompute the salience (visual importance) of each point, but not prefiltering; then, you filter the points based on the zoom level during rendering. Thus, the rendered detail increases as you zoom in, but you only need to download one TopoJSON file.

Depending on how much zooming you're doing, breaking the geometry into tiles and zoom-level specific data would be helpful (à la Polymaps), but I think for many visualization applications it's overkill. For example, a single TopoJSON file of U.S. states and counties with enough detail for both a national and state-specific view is easily doable without tiling.

The next release of D3 (3.0) includes streaming geometry transformations. This can enable fast filtering of geometry using the precomputed salience during rendering as described above without the overhead of creating multiple copies of the geometry during the rendering pipeline. Also, D3 3.0 supports rendering directly to Canvas, which is excellent for animated or interactive changes to the projection. For example:

http://bl.ocks.org/4183330

You can see the stream interface here:

https://github.com/mbostock/d3/blob/3.0/src/geo/stream.js




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: