An open API service indexing awesome lists of open source software.

https://github.com/geostyler/geostyler-sld-parser

GeoStyler-Style-Parser implementation for SLD
https://github.com/geostyler/geostyler-sld-parser

geostyler hacktoberfest sld

Last synced: 6 months ago
JSON representation

GeoStyler-Style-Parser implementation for SLD

Awesome Lists containing this project

README

          

# geostyler-sld-parser

[![Coverage Status](https://coveralls.io/repos/github/geostyler/geostyler-sld-parser/badge.svg?branch=main)](https://coveralls.io/github/geostyler/geostyler-sld-parser?branch=main)
[![License](https://img.shields.io/github/license/geostyler/geostyler-sld-parser)](https://github.com/geostyler/geostyler-sld-parser/blob/main/LICENSE)
[![npm version](https://badge.fury.io/js/geostyler-sld-parser.svg)](https://www.npmjs.com/package/geostyler-sld-parser)

[GeoStyler](https://github.com/terrestris/geostyler/) Style Parser implementation for Styled Layer Descriptor (SLD)

## :rocket: GeoStyler Code Sprint 2025

We are happy to announce the next GeoStyler Code Sprint from **02.-06.06.2025** in Switzerland. Be part of it! More infos on https://geostyler.org/.

### How to use

ES6:
```js
import SLDParser from 'geostyler-sld-parser';
import { Style } from 'geostyler-style';

const pointSimplePoint = {
name: 'My Style',
rules: [
{
name: 'My Rule',
symbolizers: [
{
kind: 'Mark',
wellKnownName: 'circle',
color: '#FF0000',
radius: 6
}
]
}
]
};

const parser = new SLDParser();

parser
.writeStyle(pointSimplePoint)
.then(({output: sld}) => console.log(sld))
.catch(error => console.log(error));

// Read style from string
let sldString = ' Default Styler Default Styler Gravel_Program_2016 name 1.0 1.0E7 #8000FF 3.000 ';

parser
.readStyle(sldString)
.then(({output: sldObject}) => console.log(sldObject))
.catch(error => console.log(error));

```

Browser:

```js
const pointSimplePoint = {
name: "My Style",
rules: [
{
name: "My Rule",
symbolizers: [
{
kind: "Mark",
wellKnownName: "Circle",
color: "#FF0000",
radius: 6
}
]
}
]
};
var parser = new GeoStylerSLDParser.SldStyleParser();
parser
.writeStyle(pointSimplePoint)
.then(({output: sld}) => console.log(sld))
.catch(error => console.log(error));

// Read style from string
var sldString = ' Default Styler Default Styler Gravel_Program_2016 name 1.0 1.0E7 #8000FF 3.000 ';

parser
.readStyle(sldString)
.then(({output: sldObject}) => console.log(sldObject))
.catch(error => console.log(error));
```

## Funding & financial sponsorship

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 💞