Вопрос

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