# geostyler-openlayers-parser

> GeoStyler Style Parser implementation for OpenLayers styles

Latest version **5.8.0** (published 2026-09-30) · BSD-2-Clause license · 0 weekly downloads

## Install

```sh
npm install geostyler-openlayers-parser
pnpm add geostyler-openlayers-parser
yarn add geostyler-openlayers-parser
bun add geostyler-openlayers-parser
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.8.0 |
| Published | 2026-09-30 |
| First published | 2018-05-25 |
| Weekly downloads | 0 |
| License | BSD-2-Clause |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.6.0 |
| Dependencies | 3 |
| Unpacked size | 1.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 43 |
| Maintainers | jansule, annarieger, terrestris-info, marcjansen, dnlkoch, ahennr, buehner, hwbllmnn, lukaslohoff, mholthausen, jorzekowsky, hblitza, jweskamm, kdannies, ntreff, kaivolland, simonseyock, bgerber, chrismayer |
| Keywords | geostyler, parser, style, openlayers |

## Links

- npm: https://www.npmjs.com/package/geostyler-openlayers-parser
- Repository: https://github.com/geostyler/geostyler-openlayers-parser
- Homepage: https://github.com/geostyler/geostyler-openlayers-parser#readme
- Issues: https://github.com/geostyler/geostyler-openlayers-parser/issues
- Funding: https://opencollective.com/geostyler
- npm.io page: https://npm.io/package/geostyler-openlayers-parser

## Dependencies (3)

- [@turf/centroid](https://npm.io/package/@turf/centroid.md) ^7.4.0
- [css-font-parser](https://npm.io/package/css-font-parser.md) ^2.0.0
- [geostyler-style](https://npm.io/package/geostyler-style.md) ^13.0.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 5.8.0 (latest) — 2026-09-30
- 5.0.0-next.6 (next) — 2024-06-20
- 5.7.1 — 2026-06-24
- 5.7.0 — 2026-04-20
- 5.6.1 — 2026-04-16
- 5.6.0 — 2026-04-16
- 5.5.0 — 2026-04-15
- 5.4.1 — 2026-03-16
- 5.4.0 — 2026-01-29
- 5.3.0 — 2025-11-12
- 5.2.0 — 2025-10-01
- 5.1.2 — 2025-06-11
- 5.1.1 — 2025-05-16
- 5.1.0 — 2025-05-14
- 5.0.2 — 2025-03-12
- … 70 more at https://npm.io/package/geostyler-openlayers-parser/versions

## README

# geostyler-openlayers-parser

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

[GeoStyler Style](https://github.com/geostyler/geostyler) Parser implementation for OpenLayers styles

## :rocket: GeoStyler Code Sprint 2026

We are happy to announce the next **online-only** GeoStyler Code Sprint from **28.-30.09.2026**. Be part of it! More infos on https://geostyler.org.

### How to use

The example below shows how to take a raw GeoStyler style, use the OpenLayersParser to parse the style into
an OpenLayers style, and then apply it to an OpenLayers vector layer.

ES6:
```js
import OpenLayersParser from "geostyler-openlayers-parser";
import OlLayerVector from "ol/layer/Vector";

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

const parser = new OpenLayersParser();
const layer = new OlLayerVector();

parser
  .writeStyle(pointSimplePoint)
  .then(({output: olStyle}) => layer.setStyle(olStyle))
  .catch(error => console.log(error));
```

Browser:

```js
var pointSimplePoint = {
  name: "OL Style", rules: [{
    name: "OL Style Rule 0",
    symbolizers: [{
      kind: "Mark",
      wellKnownName: "circle",
      color: "#FF0000",
      radius: 6
    }]
  }]
};
var vectorLayer = new ol.layer.Vector();
var parser = new GeoStylerOpenlayersParser.OlStyleParser(ol);
parser.writeStyle(pointSimplePoint)
.then(function(style) {
    if (style.errors) {
      console.log(style.errors);
    } else {
      vectorLayer.setStyle(style.output);
    }
});
```

## <a name="funding"></a>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 💞

---
_Source: https://npm.io/package/geostyler-openlayers-parser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
