topojson/topojson-client

topomerge can't deduplicate geometries

Opened this issue · 2 comments

I expected topomerge to be able to deduplicate geometries but it didn't work:

topomerge -k 'd.id' < foo.json

Geometries come out like this:

{"type":"MultiPolygon","arcs":[[]],"id":"1"}
// etc.

As a workaround I used ndjson-reduce 'p[d.id] = d, p' '{}' | ndjson-split 'Object.values(d)' on the GeoJSON features first.

Right—that’s not how topojson.merge (topomerge) works. It expects the input to be topologically-consistent and non-overlapping. Could probably be documented better, though.

I might have been having a different issue, but it sounds similar it's quite nuanced describing the differences. I had two shapefiles which shared a border, but when I merged them into the same topojson file the borders didn't match up despite them being very similar. The fix was that I was doing the quantization after conversion to topojson, when you need to do at the point you load both files. I hope this is correct and helpful to other people.

geo2topo -q 1e5 -n nuts=raw/ndjson/nuts.ndjson