geostyler / geostyler-cli

BSD 2-Clause "Simplified" License
21 stars 8 forks source link

GeoStyler CLI

A command line interface for GeoStyler to convert between various formats for styling of geographic data.

tl;dr

npx geostyler-cli --output new-qgis-style.qml my-existing.sld

Requirements

geostyler-cli can either be run as a standalone application or installed using Node.js.

Standalone application

Binaries are available for Linux, MacOS, and Windows on the Releases page. Download the zip file for your operating system, unzip, navigate to the folder and run the geostyler command:

geostyler-cli --output new-qgis-style.qml my-existing.sld

Usage without installation ⚡

Node.js includes npx, this allows you to run commands from an npm package without having to install it.

npx geostyler-cli -s sld -t qgis -o output.qml input.sld

Global installation

Installation 💾

Node.js includes npm - the JavaScript package manager. To install the geostyler command globally:

npm install -g geostyler-cli

You can then use the new geostyler-cli command, e.g.:

geostyler-cli -s sld -t qgis -o output.qml input.sld

To process a folder of files:

geostyler-cli -s sld -t qgis -o /outputdir /inputdir

Update 🚀

npm update -g geostyler-cli

Uninstalling 😔

npm uninstall -g geostyler-cli

Syntax and examples

To convert a single file:

geostyler-cli [options] -o /path/to/output.ext /path/to/input.ext
# example, relying on file extensions to select the parsers
geostyler-cli -o point_simple.sld testdata/point_simple.qml
# example with explicit parsers
geostyler-cli -s qml -t sld -o point_simple.sld testdata/point_simple.qml

To convert all files in a directory:

geostyler-cli [options] -t qgis -o /path/to/output /path/to/input/
# example
geostyler-cli -s sld -t qgis -o ./output-sld testdata/sld

To output the GeoStyler format to stdout (only available for a single file), don't set an output file or parser:

geostyler-cli [options] /path/to/input.ext
# print the GeoStyler format to stdout (relying on the file extension to select the parser)
geostyler-cli testdata/point_simple.qml
# print an SLD output to stdout
geostyler-cli -t sld testdata/point_simple.qml

Options

Developing

In your clone of the repo, in the root directory:

npm install   # get dependencies
npm run build # build from possibly changed source
# now you can call your build like this:
npm start -- -s sld -t qgis -o output.qml testdata/point_simplepoint.sld

Funding & financial sponsorship

Maintenance and further development of this code can be funded through the GeoStyler Open Collective. All contributions and expenses can transparently be reviewed by anyone; you see what we use the donated money for. Thank you for any financial support you give the GeoStyler project 💞