Skip to content

Commit

Permalink
Default -union output layer name is "union"
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Nov 26, 2019
1 parent 8cb617c commit caebaff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/commands/mapshaper-union.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ api.union = function(targetLayers, targetDataset, opts) {
});

var unionLyr = {
name: 'union',
geometry_type: 'polygon',
shapes: mosaicShapes,
data: new DataTable(mosaicRecords)
};
// if ('name' in targetLyr) unionLyr.name = targetLyr.name;
return [unionLyr];
};

Expand Down
6 changes: 3 additions & 3 deletions test/union-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ describe('mapshaper-union.js', function () {
});
});

it('union with a no-data layer works', function(done) {
it('union with a no-data layer works; default layer name is "union"', function(done) {
var fileA = 'test/test_data/issues/union/polygonA.json';
var geomB = {
type: 'Polygon',
coordinates: [[[1, 1], [2, 2], [3, 1], [2, 0], [1, 1]]]
}
var cmd = `-i polygonB.json -i ${fileA} -union target=polygonA,polygonB name=merged -o`;
var cmd = `-i polygonB.json -i ${fileA} -union target=polygonA,polygonB -o`;
api.applyCommands(cmd, {'polygonB.json': geomB}, function(err, out) {
var features = JSON.parse(out['merged.json']).features;
var features = JSON.parse(out['union.json']).features;
var records = _.pluck(features, 'properties');
assert.deepEqual(records, [
{ name: 'A', value: 4 },
Expand Down

0 comments on commit caebaff

Please sign in to comment.