Closed amandabee closed 5 years ago
Hi,
Mapshaper is getting confused by the nested quotation marks in your command. The command should work if you use:
merge-layers target='bayarea_county,california_places_clipped'
The command should also work without any quotes:
merge-layers target=bayarea_county,california_places_clipped
Quotes around command line arguments are required if there are spaces in the names, otherwise generally not needed.
An exception: Strings in JavaScript expressions need to be quoted, and the entire JS expression should be in quotes as well. -each
, -filter
and several other commands take JS expressions.
@amandabee I re-read your comment... I see that you originally used what looks like the correct syntax (without nested quotes).
I'm attaching a .zip file containing two GeoJSON files. If you drop the files onto the web UI and run merge-layers target=group1,group2
, the layers should get merged. If merging works for you with my test files but not your own data files, please send me your files and I will investigate.
group.zip
Ahh. Okay. With that first syntax I do get an error:
$ merge-layers target=bayarea_county,california_place_clipped
Fields [PLACE, PLACENUM, NAME, OBJECTID, FIPSSTCO] are missing from one or more layers
I assume this means that I need to ensure that both layers have the same fields before I can merge them. Can I just force a merge?
If you can help me get over this hurdle, I'm happy to put this particular walk through together as a tutorial and add it to the wiki.
Yes, you can force a merge by adding the "force" option to the command.
To see the all the options for a particular command, in the console you can run, e.g., -h merge-layers
.
There's also a Wiki page on Github: https://github.com/mbloch/mapshaper/wiki/Command-Reference#-merge-layers, which sometimes has more detail on using a command than the built-in command line help.
Thank you.
I was working on getting a local basemap that I can import to Datawrapper. I added it to the Wiki as a tutorial, so other folks can learn from it.
172 is related but seems to predate the
merge-layers
function. #268 also seems related but the issue appears to be resolved and I'm still hitting walls.I'm using mapshapers web interface and it looks like I should be able to collapse two layers with
merge-layers
:But the
target=
attribute isn't working:I tried putting the list in quotes and got:
How do I use
merge-layers
in the web interface?