open-index/open-npm huggingface dataset:
npm package: @kortxyz/geostyler-mapbox-parser
Description: GeoStyler-Style-Parser implementation for Mapbox
Latest version: 6.1.2

# geostyler-mapbox-parser

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

GeoStyler-Style-Parser implementation for Mapbox

### Important Notes
Since mapbox works with [spritesheets](https://docs.mapbox.com/api/maps/#sprites), geostyler-mapbox-parser is only capable of handling sprites/icons if the application that is using the parser implements following API:

`GET /sprites/?name&baseurl`
- `name` - name of the sprite in the spritesheet corresponding json
- `baseurl` - baseurl for retrieving spritesheet and sprite json

The endpoint MUST return a reference to a single image.

---

Mapbox styles require the properties [`sources`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#root-sources) (root property)
and [`source`](https://docs.mapbox.com/mapbox-gl-js/style-spec/#layer-source) (layers property).
In order to keep a clear separation between style and data, geostyler-mapbox-parser puts the source-related attributes into the metadata block of
a geostyler-style under `mapbox:ref`. There, the original sources object, as well as the mappings between layers and sources will be stored
(properties `sources`, `sourceMapping` and `layerSourceMapping`). Applications can then use these mappings for re-creating the same layer structure
using their map library of choice (e.g. OpenLayers, etc.).

### How to use

ES6:
```js
import MapboxParser from "geostyler-mapbox-parser";

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

const parser = new MapboxParser();

const { output: mbStyle } = await parser.writeStyle(pointSimplePoint);
console.log(mbStyle);
```

Browser:

```js
const pointSimplePoint = {
  name: "My Style",
  rules: [
    {
      name: "My Rule",
      symbolizers: [
        {
          kind: "Mark",
          wellKnownName: "Circle",
          color: "#FF0000",
          radius: 6
        }
      ]
    }
  ]
};
var parser = new GeoStylerMapboxParser.MapboxStyleParser();
parser
  .writeStyle(pointSimplePoint)
  .then(function(res) {
    var mbStyle = res.output;
    console.log(mbStyle);
  });
```

## <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 💞
npm package: @kortxyz/geostyler-style
Description: [![Lint & Docs (main)](https://github.com/geostyler/geostyler-style/actions/workflows/on-push-main.yml/badge.svg)](https://github.com/geostyler/geostyler-style/actions/workflows/on-push-main.yml) [![Create & publish versioned documentation](https://github
Latest version: 9.2.0

# geostyler-style

[![Lint & Docs (main)](https://github.com/geostyler/geostyler-style/actions/workflows/on-push-main.yml/badge.svg)](https://github.com/geostyler/geostyler-style/actions/workflows/on-push-main.yml)
[![Create & publish versioned documentation](https://github.com/geostyler/geostyler-style/actions/workflows/on-publish.yml/badge.svg)](https://github.com/geostyler/geostyler-style/actions/workflows/on-publish.yml)
[![License](https://img.shields.io/github/license/geostyler/geostyler-style)](https://github.com/geostyler/geostyler-style/blob/main/LICENSE)

TypeScript Declaration File for the [GeoStyler](https://github.com/geostyler/geostyler) Style.

### Documentation

https://geostyler.github.io/geostyler-style/docs/main/

### Why another style format?

The *Geostyler Style* is not primarily intended to be a new standard for styling geographic data.

The main task of the format is to be an **exchange format** for all the other standards. It should be
capable of storing the styling possibilities of SLD, OpenLayers-Styles, MapBox-Styles, CartoCSS (and others)
while being easily read- and writable.

On the other hand it is used by the [GeoStyler](https://github.com/geostyler/geostyler) to build the UI components. This
way you should be able to configure any type of style via UI and also translate between all supported formats (in theory :grin:).

### TypeGuards

In addition to the definition itself, there are some custom [TypeGuards](https://basarat.gitbook.io/typescript/type-system/typeguard#user-defined-type-guards) that can be used as utility methods to enhance the coding experience with the geostyler-style.

```typescript
import { isFilter, isSymbolizer } from 'geostyler-style/dist/typeguards';
```

## <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 💞