Git Product home page Git Product logo

geostyler-style's Introduction

geostyler-style

Lint & Docs (main) Create & publish versioned documentation License

TypeScript Declaration File for the 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 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 😁).

TypeGuards

In addition to the definition itself, there are some custom TypeGuards that can be used as utility methods to enhance the coding experience with the geostyler-style.

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

Funding & financial sponsorship

Maintenance and further development of this code can be funded through the GeoStyler Open Collective. 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 πŸ’ž

geostyler-style's People

Contributors

ahennr avatar chrismayer avatar dependabot-preview[bot] avatar dependabot[bot] avatar dnlkoch avatar ger-benjamin avatar greenkeeper[bot] avatar hwbllmnn avatar jahow avatar jansule avatar juburr avatar kaivolland avatar marcjansen avatar ocruze avatar renovate[bot] avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geostyler-style's Issues

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm @babel/plugin-proposal-object-rest-spread Unavailable

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency @commitlint/cli to v19.4.0
  • chore(deps): update dependency semantic-release to v24.1.0
  • chore(deps): update dependency typescript to v5.5.4
  • chore(deps): update dependency typescript-json-schema to ^0.65.0
  • πŸ” Create all rate-limited PRs at once πŸ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/commitlint.yml
  • actions/checkout v4
  • wagoid/commitlint-github-action v6
.github/workflows/notify-discord.yml
  • Ilshidur/action-discord 0.3.2
.github/workflows/on-publish.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • JamesIves/github-pages-deploy-action v4.6.1
  • JamesIves/github-pages-deploy-action v4.6.1
.github/workflows/on-pull-request.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
.github/workflows/on-push-main.yml
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • actions/checkout v4
  • actions/setup-node v4
  • actions/cache v4
  • JamesIves/github-pages-deploy-action v4.6.1
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-node v4
  • cycjimmy/semantic-release-action v4.1.0
npm
package.json
  • @babel/core ^7.24.6
  • @babel/plugin-proposal-object-rest-spread ^7.20.7
  • @babel/preset-env ^7.24.6
  • @babel/preset-typescript ^7.24.6
  • @commitlint/cli ^19.3.0
  • @commitlint/config-conventional ^19.2.2
  • @semantic-release/changelog ^6.0.3
  • @semantic-release/git ^10.0.1
  • @terrestris/eslint-config-typescript ^5.0.0
  • @types/jest ^29.5.12
  • @typescript-eslint/parser ^7.12.0
  • babel-jest ^29.7.0
  • conventional-changelog-conventionalcommits ^7.0.2
  • core-js ^3.37.1
  • eslint ^8.57.0
  • jest ^29.7.0
  • semantic-release ^24.0.0
  • typedoc ^0.25.13
  • typescript ^5.4.5
  • typescript-json-schema ^0.64.0
  • node >=20.6.0
  • npm >=10.0.0
nvm
.nvmrc
  • node 20.15.0

  • Check this box to trigger a request for Renovate to run again on this repository

How to engage with community?

Question

Hi, I am evaluating the geostyler project for use in one of our products.

I was wondering how to engage with the community - is there a mailing list or gitter or something like that?

dave

Add zoom/scale expression

Feature Request

Is your feature request related to a problem? Please describe.

Some formats/styles may contain zoom/scale based expressions that are currently not supported in geostyler-style.

E.g. see following mapbox snippet:

"paint": {
      "line-width": [
          "interpolate",
          ["linear"],
          ["zoom"], // <--------- zoom level as input for the interpolate expression
          12,
          2,
          15,
          4,
          19,
          35
      ]
}

Describe the solution you'd like

It would be great to include this into geostyler-style.

Please note that SLD does not seem to support zoom/scale based expressions. There, the scaleDenominators seem to be the only way of handling different styles based on zoom/scale.

Describe alternatives you've considered
...

Additional context
...

Special literal meaning "linebreak"

Feature Request

Hello,

In some solutions, it's possible to have a "new line" between two texts. Example:
Wanted result:

1234
My shape

With ArcGIS:
"[FOKR]&vbNewLine& [FOKRNAME] "

With GeoServer:

            <Label>
              <ogc:Function name="Concatenate">
                <ogc:PropertyName>fokr</ogc:PropertyName>
                <ogc:Function name="Concatenate">
                  <ogc:Literal><![CDATA[
]]></ogc:Literal>
                  <ogc:PropertyName>fokrname</ogc:PropertyName>
                </ogc:Function>
              </ogc:Function>
            </Label>

Describe the solution you'd like
It would be great to have a special literal for that in the Geostyler style format. Maybe something like a WellKnownName ?
Or it is already existing and I missed it ?

Clean Up StyleParser Interface

Feature Request

Is your feature request related to a problem? Please describe.

The StyleParserInterface could be cleaned up. Some ideas:

  • remove deprecated properties/methods
  • replace interface with class, so that we can add unsupportedProperties as static property (see #607)

UnsupportedProperties as static field

Feature Request

Is your feature request related to a problem? Please describe.

It would be great to have the unsupportedProperties as static property instead of an instance property. This would allow to use the unsupportedProperties property without having to instantiate a parser.

Describe the solution you'd like

--

Describe alternatives you've considered

--

Additional context

--

Asymetric `MarkSymbolizer`

Currently the size of a MarkSymbolizer is described by a single value: radius

To allow asymetric symbolizers (eg. rectangle instead of square) the radius property could be replaced with: size which would be typed as [Expression<number>, Expression<number>] or we could add this type to the radius so it would look like this:

radius?: Expression<number> | [Expression<number>, Expression<number>]

Type instantiation is excessively deep and possibly infinite.

Bug

Describe the bug
Error reported when using the 【Rule or Filter】 interface
import { Rule as GeoRule, Filter as GeoFilter, } from 'geostyler-style'
whenever I use GeoRule or GeoFilter,the error will show. The error message is "Type instantiation is excessively deep and possibly infinite."

[geostyler-style] Property duplicates

Some properties in geostyler-style refer to the same property (event though they have different names). It looks as if some properties where derived from mapbox and others from sld. We should decide on only one of each and remove the other, respectively.

FillSymbolizer

  • graphicFill vs fillPattern

My proposal is to remove the fillPattern property, as it is not being used yet and is not as powerful as graphicFill (specifying the url to an image vs specifying a point symbolizer).

LineSymbolizer

  • perpendicularOffset vs offset
  • graphicFill vs pattern
  • graphicStroke vs gradient

Improve Typings

Currently there are some minor issue with the types of the geostyler-style. We should check if we can improve these types without breaking changes.

  1. GeoStylerFunction is a union type of all functions. This leads to issues with the (currently two) functions that don't have args. In particular TypesScript says that a GeoStylerFunction has no property args unless you exclude the functions without args. We should avoid adding an empty array as args but find a TypeScript way for this.

  2. PropertyType includes unknown. This translates to PropertyType = unknown which is obviously not perfect.

TextSymbolizer label placement

Feature Request

Is your feature request related to a problem? Please describe.

The TextSymbolizer does currently not support a property for setting the label placement. Due to this, we are currently not able to make the labels of a line (e.g. a street) follow the line.

Describe the solution you'd like

We should add a property (e.g. labelPlacement) that handles this.

In mapbox this property is called symbol-placement (see https://docs.mapbox.com/style-spec/reference/layers/#layout-symbol-symbol-placement).

In OpenLayer this property is called placement (see https://openlayers.org/en/v7.5.2/apidoc/module-ol_style_Text.html#~TextPlacement).

Describe alternatives you've considered

None

Additional context

Style using different placements due to lack of support:

image

Host Style Documentation on github pages

Feature Request

Is your feature request related to a problem? Please describe.

We have a documentation for the geostyler-style that can be built with npm run generate-docs.

Describe the solution you'd like

We should host this documentation on gh-pages so it is accessible for everyone.

Describe alternatives you've considered

None

Additional context

None

Add more functions

It seems like we are missing some functions to be able to cover more complex operations:

Boolean:

  • 'all'
  • 'any'
  • 'not' -> inverts one argument
  • 'equalTo'
  • 'notEqualTo'
  • 'like' --> covered by strMatches
  • 'greaterThan'
  • 'greaterThanOrEqualTo'
  • 'lessThan'
  • 'lessThanOrEqualTo'

Mathematical:

  • 'add'
  • 'sub'
  • 'mul'
  • 'div'

Unknow:

  • 'switch' or 'case'
  • 'coalesce'?

Issues with tutorial and documentation

Bug

I am a JS tool-chain beginner. I'm trying to follow the beginner tutorial and the github documentation.

Beginner Tutorial

https://geostyler.github.io/geostyler-beginner-workshop/

I installed the latest node 12, and then tried to run the big code block in the "Parsing SLD" section.

However, I get an error (in the browser) when i do this:

"Error: Objects are not valid as a React child (found: object with keys {errors}). If you meant to render a collection of children, use an array instead."

I did some digging and the error is in the sldParser.writeStyle(style) method.

"Cannot read properties of undefined (reading 'map')"

http://localhost:3000/static/js/vendors~main.chunk.js:4433:31
    at new Promise (<anonymous>)
    at SldStyleParser.writeStyle (http://localhost:3000/static/js/vendors~main.chunk.js:4424:12)
    at http://localhost:3000/static/js/main.chunk.js:81:15
    at invokePassiveEffectCreate (http://localhost:3000/static/js/vendors~main.chunk.js:33831:24)
    at HTMLUnknownElement.callCallback (http://localhost:3000/static/js/vendors~main.chunk.js:14447:18)
    at Object.invokeGuardedCallbackDev (http://localhost:3000/static/js/vendors~main.chunk.js:14496:20)
    at invokeGuardedCallback (http://localhost:3000/static/js/vendors~main.chunk.js:14556:35)
    at flushPassiveEffectsImpl (http://localhost:3000/static/js/vendors~main.chunk.js:33913:13)
   at unstable_runWithPriority (http://localhost:3000/static/js/vendors~main.chunk.js:47944:16)
    at runWithPriority$1 (http://localhost:3000/static/js/vendors~main.chunk.js:21853:14)
    at flushPassiveEffects (http://localhost:3000/static/js/vendors~main.chunk.js:33790:18)
    at http://localhost:3000/static/js/vendors~main.chunk.js:33671:15
    at workLoop (http://localhost:3000/static/js/vendors~main.chunk.js:47894:38)
    at flushWork (http://localhost:3000/static/js/vendors~main.chunk.js:47868:18)
   at MessagePort.performWorkUntilDeadline (http://localhost:3000/static/js/vendors~main.chunk.js:47634:31)"

Sorry I cannot give more details, but that's the best info I could get with my knowledge.

Trying to Install Geostyler with npm

I noticed that the advanced workshop used node v6. I went to another machine, and installed the latest node (brew install node@16).

npm i geostyler

This failed.

I went to node v14 (brew install node@14).

npm i geostyler

This worked. Perhaps the documentation should indicate which node version to run.

Trying to get SLD parser working

I then moved on to https://github.com/geostyler/geostyler-sld-parser so I could try to get the tutorial code working.

I wasn't sure how to run the sample code (README).

The documentation shows this;
const parser = new SLDParser();

The code seems to indicate that this should be SldStyleParser - see https://github.com/geostyler/geostyler-sld-parser/blob/master/src/SldStyleParser.ts#L69

The second example in the README uses;
var parser = new GeoStylerSLDParser.SldStyleParser();

I was able to get this working (code in app.js node app.js):

const geostyler_sld_parser = require("geostyler-sld-parser")
var parser = new geostyler_sld_parser.SldStyleParser();
const pointSimplePoint = {
                   ...
};

parser
  .writeStyle(pointSimplePoint)
  .then(function(sld) {
    console.log(sld);
  })
  .catch(function(error) {
    console.log(error);
  });

I think the README should be updated to use SldStyleParser and perhaps add an easy-to-run node command (as above).

I will try to add a doc update to the Git repo, but I have no idea what's wrong with the tutorial.

YAML from ts for documenting purposes

I was discussing with @chrismayer that it would facilitate discussion on the geostyler spec if it were published somewhere as a YAML file. YAML is for some (e.g. me) more easy to read then ts. I was checking if there are some libs around that would offer such functionality, I found this https://github.com/manifoldco/swagger-to-ts but it is the other way around. Any ideas how to auto generate such a YAML?

We probably loose some information in the conversion as ts seems more extended then YAML, but for me it would help explaining what we're doing.

Thanx for you consideration.

Consider units while parsing between styles

Feature Request

Is your feature request related to a problem? Please describe.
The units of individual objects must be defined by the initial style and passed on to the GeoStyler style. From there, the defined unit must be sent to the target style.

Describe the solution you'd like
GeoStyler should use the units of the source style when converting until other units are defined there. These should then also be applied in the target style.
See also geostyler/geostyler#1434

Additional context
At the moment, especially in geostyler-qgis-parser, the units in the code are hard defined as Pixel or missing entirely (e.g. line_width_unit)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.