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
- Host: GitHub
- URL: https://github.com/geostyler/geostyler-sld-parser
- Owner: geostyler
- License: bsd-2-clause
- Created: 2018-05-15T13:59:08.000Z (about 8 years ago)
- Default Branch: main
- Last Pushed: 2025-05-05T23:40:31.000Z (about 1 year ago)
- Last Synced: 2025-05-06T00:34:19.977Z (about 1 year ago)
- Topics: geostyler, hacktoberfest, sld
- Language: TypeScript
- Homepage:
- Size: 5.3 MB
- Stars: 55
- Watchers: 19
- Forks: 36
- Open Issues: 28
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# geostyler-sld-parser
[](https://coveralls.io/github/geostyler/geostyler-sld-parser?branch=main)
[](https://github.com/geostyler/geostyler-sld-parser/blob/main/LICENSE)
[](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 💞