Skip to content

Commit

Permalink
v0.6.47
Browse files Browse the repository at this point in the history
  • Loading branch information
mbloch committed Nov 14, 2023
1 parent d4a072b commit 1792868
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v0.6.47
* Added support for using JSON data as an argument to the -i command.
* Added an `io` object with an `io.addInputFile()` method to the `-run` command's expression context, to support loading dynamically generated datasets.

v0.6.46
* Added save to clipboard option to web UI export menu.
* In -each expressions, `this.geojson` setter now accepts nulls and FeatureCollectsions in addition to single Features.
Expand Down
23 changes: 19 additions & 4 deletions 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.45 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.47 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 Expand Up @@ -138,7 +138,7 @@ By default, multiple input files are processed separately, as if running mapshap

**Options**

`<files>` or `files=` File(s) to input (space-separated list). Use `-` to import TopoJSON or GeoJSON from `/dev/stdin`.
`<files>` or `files=` File(s) to input (space-separated list). Use `-` to import TopoJSON or GeoJSON from `/dev/stdin`. Literal JSON data can also be used instead of a file name.

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

Expand Down Expand Up @@ -1045,11 +1045,11 @@ $ mapshaper data.json \

Create mapshaper commands on-the-fly and run them.

`<expression>` or `expression=` A JS expression for generating one or more mapshaper commands. The expression has access to a "target" object with information about the currently targeted layer, as well as modules loaded with the `-require` command.
`<expression>` or `expression=` A JS expression for generating one or more mapshaper commands. The expression has access to a "target" object with information about the currently targeted layer, as well as modules loaded with the `-require` command. In v0.6.47, an "io" object was added, with an `io.addInputFile(<filename>, <data>)` method, to support importing dynamically generated datasets (see Example 2 below).

Common options: `target=`

**Example:** Apply a custom projection based on the layer extent
**Example 1:** Apply a custom projection based on the layer extent

```bash
$ mapshaper -i country.shp -require projection.js -run 'getProjCommand(target)' -o
Expand All @@ -1067,6 +1067,21 @@ module.exports = {

```

**Example 2:** Import a dynamically generated dataset

```bash
$ mapshaper -require script.js -run 'importData(io)' -o
```

```javascript
// contents of script.js file
module.exports = {
importData: function(io) {
var data = [{"foo": "bar"}];
io.addInputFile('data.json', data);
return `-i data.json`;
}
};


### -shape
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.46",
"version": "0.6.47",
"description": "A tool for editing vector datasets for mapping and GIS.",
"keywords": [
"shapefile",
Expand Down

0 comments on commit 1792868

Please sign in to comment.