3

Is it possible, using TopoJSON Client to merge/join geometries. So, for example, this:

{"type":"Topology","objects":{"areas":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[[3053,3054,3055]],[[3075,3076,3077]]]},{"type":"Polygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[3293,3294,3295,]]},{"type":"MultiPolygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[[3011,3012,3013]],[[3014,3015,3016]]]},

would become (something like) this:

{"type":"Topology","objects":{"areas":{"type":"GeometryCollection","geometries":[{"type":"MultiPolygon","properties":{"common":"S B","class":"range s-b"},"arcs":[[[3053,3054,3055]],[[3075,3076,3077]]],[[3293,3294,3295,]],[[[3011,3012,3013]],[[3014,3015,3016]]]},

In other words, remove the duplication, combining the multipolygon and polygon arc arrays into one, merged, array of multipolygons.

Moving from, lots of shapes (there are 5 multipolygon arrays, in total):

enter image description here

to, just one:

enter image description here

If I could remove any superfluous internal borders and some of the detail too, that would be a bonus - as my aim is to reduce the file size.

My script looks like this:

geo2topo areas=input.json \
| topoquantize 1e5 \
> output.json

I tried:

topomerge total_areas=areas -k 'd.properties.common' \
< output.json \
> output2.json

...but this did not achieve the aim.

I could try to manipulate the GeoJSON, but it seems, from the available documentation, that simplification and compression is best performed after the JSON is formatted into TopoJSON.

dbj44
  • 1,919
  • 2
  • 24
  • 45

0 Answers0