I'm trying to simplify several geojson and topojson files at once to output them into one file with a consistent level of detail. I'm using Mapshaper because I like it's map simplification features.

I see in the docs that it has a combine-files feature:

combine-files Import multiple files to separate layers with shared topology. Useful for generating a single TopoJSON file containing multiple geometry objects.

That's exactly what I want to do, but there's no example and everything I've tried doesn't work.

I've tried applying it in the input commands box before upload, at the same time as upload, after upload, with and without quotes, and from the console and output box after upload. They all just show the separate files as separate files.

How do I use combine-files to upload / input multiple files into one?

I noticed that the browser interface seems to automatically treat multiple files as layers, so I tried -merge-layers name="another layer" target="selected layer", or -merge-layers name="another layer", but it replaced the layer instead of merging.

Basically I just want to be able to see and simplify the contents of multiple files at once, to ensure consistency and no gaps between layers that border each other, then output them as (ideally) one file with one layer for each original file.

  • merge-files and combine-files, github.com/mbloch/mapshaper/issues/57
    – klewis
    Aug 8, 2016 at 13:59
  • Now I'm even more confused, the docs say combine-files is an input parameter but in that example it's being used for output! Adding it to output gives me an error Unknown output option: combine-files Aug 8, 2016 at 14:49

1 Answer 1


The combine-files option is only for the input (-i) command which is not available on the browser version. When using mapshaper in the browser you can see all your layers but notice that the "source file" for each one is different. I think that the simplification command can only take in consideration layers in the same file, hence the combine-files option exists.

To use the command line version and have a custom input, install Node.js 6.x and then mapshaper by running this command in your terminal (may require sudo):

$ npm install --global mapshaper

Now you can combine the layers in a single file and simplify them with something like this:

$ mapshaper \
    -i ./my-topo-file.json ./my-topo-file2.json ./my-geo-file.json ./my-shape-file.shp snap combine-files \
    -rename-layers topo1,topo2,geo,shape \
    -merge-layers target=topo1,topo2,geo,shape name=merged-layers \
    -simplify weighted 3% \
    -o ./output-topo.json format=topojson target=merged-layers bbox prettify force

To understand the above commands and all others available, see the command line reference.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.