geostyler-cli
v5.0.4
Published
A command line interface for [GeoStyler](https://geostyler.org) to convert between various formats for styling of geographic data.
Readme
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.sldRequirements
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.sldUsage without installation ⚡
Node.js includes npx, this
allows you to run commands from a npm package without having to install it.
npx geostyler-cli -s sld -t qgis -o output.qml input.sldGlobal installation
Installation 💾
Node.js includes npm - the
JavaScript package manager. To install the geostyler command globally:
npm install -g geostyler-cliYou can then use the new geostyler-cli command, e.g.:
geostyler-cli -s sld -t qgis -o output.qml input.sldTo process a folder of files:
geostyler-cli -s sld -t qgis -o /outputdir /inputdirUpdate 🚀
npm update -g geostyler-cliUninstalling 😔
npm uninstall -g geostyler-cliSyntax 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.qmlTo convert all files in a directory:
geostyler-cli [options] -t qgis -o /path/to/output /path/to/input/ [--quiet]
# example
geostyler-cli -s sld -t qgis -o ./output-sld testdata/sldTo 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.qmlOptions
-h/--helpDisplay the help and exit.-o/--outputOutput filename or directory. Required when the source is a directory. For a file leave this empty to write tostdout. [string]-s/--sourceSource parser, eithermapbox,mapfile,mapsld- the parser will read the version from the file -qgisorqmlfor QGIS QML files, andol-flatfor OpenLayers FlatStyles. If not given, it will be guessed from the extension of the input file. Mandatory if the target is a directory.-t/--targetTarget parser, eithermapbox,sld,qgisorqmlfor QGIS QML files. If not given, it will be guessed from the extension of the output file. Mapfiles are not currently supported as target. Mandatory if the target is a directory.--sourceOptionsOptions for the constructor of the source parser. This must be a comma-separated string like--sourceOptions 'version:1.1.0,debug:true'.--targetOptionsSame as sourceOptions, but for the target parser.-v/--versionDisplay the version of the program.--quietSuppress all interactive output.
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.sldFunding & 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 💞
