mbostock/topojson — pull request #89 by adamhooper (2013-06-28 23:09:31+00:00)
Title: Remove points from arcs that are [0,0]

In a production topology, I found that simplify() often leaves [0,0] points within arcs. Those are, of course, useless. But removing them opens a whole can of worms:

* All of this should only happen if --allow-empty is not set.
* If the [0,0] occurs in the middle of an arc, it's easy to remove
* If the [0,0] occurs as the first coordinate of the arc, that's of course fine since (since it's an absolute point, not a relative one)
* If the [0,0] occurs as the final coordinate of the arc, then it should be removed ... right? Should we worry if `arc[arc.length -1].area != Infinity`?
* If the arc is a two-point arc and the [0,0] occurs as the second point, the entire arc should be deleted. That means we need to walk the tree to change all arc IDs.
* If a geometry loses all its arcs, the geometry should be deleted.

Agree?

I've left the code rather monolithic to check for agreement first. I hope it's readable enough for a general yay/nay. If you prefer to give some higher-level suggesions rather than comb through the code, feel free. (Should it be a separate object/file/etc?)