Skip to content

Commit

Permalink
v0.6.98
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Jun 16, 2024
1 parent 2da18a3 commit b9fccf5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v0.6.98
* Added remove-empty flag for -filter-slivers command.

v0.6.97
* [web] Prompt user to project imported files to match selected layer, when relevant.
* [svg] Add fill="none" to unstyled rectangle layers, to prevent map frame rectangles from displaying with SVG default black polygon fill.
Expand Down
2 changes: 1 addition & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# COMMAND REFERENCE

This documentation applies to version 0.6.67 of mapshaper's command line program. Run `mapshaper -v` to check your version. For an introduction to the command line tool, read [this page](https://github.com/mbloch/mapshaper/wiki/Introduction-to-the-Command-Line-Tool) first.
This documentation applies to version 0.6.98 of mapshaper's command line program. Run `mapshaper -v` to check your version. For an introduction to the command line tool, read [this page](https://github.com/mbloch/mapshaper/wiki/Introduction-to-the-Command-Line-Tool) first.

## Command line syntax

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mapshaper",
"version": "0.6.97",
"version": "0.6.98",
"description": "A tool for editing vector datasets for mapping and GIS.",
"keywords": [
"shapefile",
Expand Down
2 changes: 0 additions & 2 deletions src/cli/mapshaper-options.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -975,12 +975,10 @@ export function getOptionParser() {
// describe: 'multiply min-area by Polsby-Popper compactness (0-1)'
type: 'flag',
})
/*
.option('remove-empty', {
type: 'flag',
describe: 'delete features with null geometry'
})
*/
.option('target', targetOpt);

parser.command('graticule')
Expand Down
5 changes: 5 additions & 0 deletions src/commands/mapshaper-filter-slivers.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ function filterSlivers(lyr, dataset, optsArg) {

editShapes(lyr.shapes, pathFilter);
message(utils.format("Removed %'d sliver%s using %s", removed, utils.pluralSuffix(removed), filterData.label));

// Remove null shapes (likely removed by clipping/erasing, although possibly already present)
if (opts.remove_empty) {
cmd.filterFeatures(lyr, dataset.arcs, {remove_empty: true, verbose: false});
}
return removed;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gui/gui-interaction-mode-control.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function InteractionMode(gui) {
box: 'rectangle tool',
data: 'edit attributes',
labels: 'position labels',
edit_points: 'add/edit points',
edit_points: 'add/drag points',
edit_lines: 'draw/edit polylines',
edit_polygons: 'draw/edit polygons',
vertices: 'edit vertices',
Expand Down
9 changes: 9 additions & 0 deletions test/filter-slivers-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ import api from '../mapshaper.js';

describe('mapshaper-filter-slivers.js', function () {

it('remove-empty flag', async function() {
var cmd = `-i test/data/two_states_mercator.shp -explode -filter-slivers
min-area=100km2 remove-empty -o output.json`;
var out = await api.applyCommands(cmd);
var features = JSON.parse(out['output.json']).features;
assert.equal(features.length, 4);
});


describe('calcMaxSliverArea()', function () {
it('ignores relatively long segments', function () {
var coords2 = [[[3, 1], [2, 1], [2, 2]], [[2, 3], [3, 3]], [[1, 3], [4, 3], [4, 0]]],
Expand Down

0 comments on commit b9fccf5

Please sign in to comment.