The wiki says:

Equivalent to topojson.merge / .mesh, but returns a TopoJSON MultiPolygon / MultiLineString object rather than GeoJSON.

But what does it mean? What would be a good usage example of the TopoJSON MultiPolygon / MultiLineString objects returned? I tried to replace:

topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; })

... with:

topojson.meshArcs(world, world.objects.countries, function(a, b) { return a !== b; })

...but got the error Uncaught TypeError: Cannot read property 'length' of undefined from d3.js.

有帮助吗?

解决方案

The difference is that merge and mesh return GeoJSON features which can be passed to d3.geo.path to be displayed on screen using SVG path elements. In contrast, mergeArcs and meshArcs return topologies, which would need to be passed back to topojson.feature to be passed to d3.geo.path to be displayed.

The reason why you would use mergeArcs and meshArcs is because you wanted to perform further topological functions on your data, like merging them or finding neighbors.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top