diff --git a/README.md b/README.md
index a87a344..170c222 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@ between various formats for styling of geographic data.
## tl;dr
```
-npx geostyler-cli --output new-qgis-style.qml my-existing.sld
+bunx geostyler-cli --output new-qgis-style.qml my-existing.sld
```
## Requirements
@@ -15,7 +15,7 @@ npx geostyler-cli --output new-qgis-style.qml my-existing.sld
## Standalone application
-Binaries are available for Linux, MacOS, and Windows on the
+Binaries are available for Linux, MacOS, and Windows on the
[Releases](https://github.com/geostyler/geostyler-cli/releases) page.
Download the zip file for your operating system, unzip, navigate to the folder
and run the `geostyler` command:
@@ -26,50 +26,13 @@ geostyler-cli --output new-qgis-style.qml my-existing.sld
## Usage without installation ⚡
-`Node.js` includes [npx](https://docs.npmjs.com/cli/v10/commands/npx), this
+`Bun` includes [bunx](https://bun.sh/docs/cli/bunx), 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
+bunx geostyler-cli -s sld -t qgis -o output.qml input.sld
```
-## Global installation
-
-### Installation 💾
-
-`Node.js` includes [npm](https://docs.npmjs.com/cli/v10/commands/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:
@@ -106,12 +69,12 @@ geostyler-cli -t sld testdata/point_simple.qml
* `-h` / `--help` Display the help and exit.
* `-o` / `--output` Output filename or directory. Required when the source is a directory.
For a file leave this empty to write to `stdout`. [string]
-* `-s` / `--source` Source parser, either `mapbox`, `mapfile` or `map`,
+* `-s` / `--source` Source parser, either `mapbox` (`maplibre`), `lyrx`, `mapfile` or `map`,
`sld` or `se` for SLD - the parser will read the version from the file,
-and `qgis` or `qml` for QGIS QML files. If not given, it will be guessed from the extension of the input file.
+and `qgis` (`qml`) for QGIS QML files. If not given, it will be guessed from the extension of the input file.
Mandatory if the the target is a directory.
-* `-t` / `--target` Target parser, either `mapbox`, `sld` (for SLD 1.0), `se` (for SLD 1.1),
-and `qgis` or `qml` for QGIS QML files. If not given, it will be guessed from
+* `-t` / `--target` Target parser, either `mapbox` (`maplibre`), `ol`, `sld` (for SLD 1.0), `se` (for SLD 1.1),
+and `qgis` (`qml`) for 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 the target is a directory.
* `-v` / `--version` Display the version of the program.
@@ -121,10 +84,10 @@ Mandatory if the the target is a directory.
In your clone of the repo, in the root directory:
```bash
-npm install # get dependencies
-npm run build # build from possibly changed source
+bun install # get dependencies
+bun 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
+bun run start -- -s sld -t qgis -o output.qml testdata/point_simplepoint.sld
```
## Funding & financial sponsorship
@@ -133,4 +96,3 @@ Maintenance and further development of this code can be funded through the
[GeoStyler Open Collective](https://opencollective.com/geostyler). 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 💞
-
diff --git a/src/index.ts b/src/index.ts
index 0ab47bd..3a2f3c9 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,10 +1,11 @@
-#!/usr/bin/env node
-
import SLDParser from 'geostyler-sld-parser';
import QGISParser from 'geostyler-qgis-parser';
-// import OpenLayersParser from "geostyler-openlayers-parser";
+import OpenLayersParser from 'geostyler-openlayers-parser';
import MapfileParser from 'geostyler-mapfile-parser';
import MapboxParser from 'geostyler-mapbox-parser';
+import ArcGISParser from 'geostyler-lyrx-parser';
+import { StyleParser } from 'geostyler-style';
+
import {
existsSync,
lstatSync,
@@ -13,7 +14,6 @@ import {
readdirSync
} from 'fs';
import minimist from 'minimist';
-import { StyleParser } from 'geostyler-style';
import ora, { Ora } from 'ora';
import {
logHelp,
@@ -33,10 +33,10 @@ const getParserFromFormat = (inputString: string): StyleParser | undefined => {
throw new Error('No input');
}
switch (inputString.toLowerCase()) {
- // case 'openlayers':
- // case 'ol':
- // return new OpenLayersParser();
+ case 'lyrx':
+ return new ArcGISParser();
case 'mapbox':
+ case 'maplibre':
return new MapboxParser();
case 'mapfile':
case 'map':
@@ -62,9 +62,12 @@ const getParserFromFilename = (fileName: string): StyleParser | undefined => {
return undefined;
}
switch (fileEnding.toLowerCase()) {
- // case 'ol':
- // return new OpenLayersParser();
+ case 'ol':
+ return new OpenLayersParser();
+ case 'lyrx':
+ return new ArcGISParser();
case 'mapbox':
+ case 'maplibre':
return new MapboxParser();
case 'map':
return new MapfileParser();
@@ -158,13 +161,21 @@ function collectPaths(basePath: string, isFile: boolean): string[] {
}
async function writeFile(
- sourceFile: string, sourceParser: StyleParser,
- targetFile: string, targetParser: StyleParser | undefined,
+ sourceFile: string, sourceParser: Exclude,
+ targetFile: string, targetParser: Exclude | undefined,
oraIndicator: Ora
) {
const inputFileData = await promises.readFile(sourceFile, 'utf-8');
const indicator = oraIndicator; // for linter.
+ if (sourceParser instanceof OpenLayersParser) {
+ throw new Error('OpenLayers is not supported as source.');
+ }
+
+ if (targetParser instanceof ArcGISParser || targetParser instanceof MapfileParser) {
+ throw new Error('ArcGIS (lyrx) and MapFile are not supported as target.');
+ }
+
try {
indicator.text = `Reading from ${sourceFile}`;
const {