GeoStyler Style

raw JSON →
12.0.0 verified Fri May 01 auth: no javascript

A TypeScript declaration file and utility library defining the geostyler-style format, an exchange format for representing geographic styles that can be translated between SLD, OpenLayers, Mapbox, CartoCSS and other standards. Current stable version is 12.0.0, released April 2026. The package ships TypeScript types and includes type guards for runtime type checking. It is developed as part of GeoStyler project, which provides UI components for building styles. Key differentiator: designed as an interchange format rather than a new styling standard, capable of capturing capabilities of multiple style formats while remaining human-readable.

error Cannot find module 'geostyler-style' or its corresponding type declarations.
cause Missing installation or missing TypeScript types.
fix
Run npm install geostyler-style@12.0.0. Ensure tsconfig.json includes "node" in compilerOptions.types or "esModuleInterop": true.
error Module not found: Can't resolve 'geostyler-style/dist/typeguards'
cause Importing from internal dist/ path which may have moved.
fix
Change import to 'geostyler-style' (typeguards are re-exported in v12+).
breaking Expression type extended to support 'geometry' parameter; GeoStylerUnknownFunction extended with Fcustom functions.
fix If you define custom functions, ensure they conform to the updated GeoStylerUnknownFunction type. For expressions using 'geometry', update type annotations accordingly.
breaking Package structure changed in v10.2.0 and reverted in v11.0.0; imports from dist/ paths may break.
fix Use direct imports like 'geostyler-style' instead of 'geostyler-style/dist/...'. If you had imports referencing dist/ for v10.2.0–10.5.0, remove the dist/ path segment.
breaking Package now ESM-only; CJS require will throw error.
fix Switch from require() to import statements. If you must use CJS, use dynamic import(): const { Styler } = await import('geostyler-style')
deprecated Importing from 'geostyler-style/dist/typeguards' is deprecated; re-exports from main entry exist since v12.0.0.
fix Change import to 'geostyler-style' directly. For example: import { isFilter } from 'geostyler-style'
npm install geostyler-style
yarn add geostyler-style
pnpm add geostyler-style

Creates a minimal GeoStyler style with a point mark symbolizer and uses the isSymbolizer type guard.

import { Styler, Style, Rule, Symbolizer, Expression, isSymbolizer } from 'geostyler-style'

const pointStyle: Style = {
  name: 'My Point Style',
  rules: [{
    name: 'Rule 1',
    symbolizers: [{
      kind: 'Mark',
      wellKnownName: 'Circle',
      color: '#FF0000',
      radius: 6
    }]
  }]
}

// Use type guard to check symbolizer kind
if (pointStyle.rules[0].symbolizers[0].kind === 'Mark') {
  console.log(isSymbolizer(pointStyle.rules[0].symbolizers[0])); // true
}