geostyler / geostyler-openlayers-parser

GeoStyler Style Parser implementation for OpenLayers styles
BSD 2-Clause "Simplified" License
38 stars 30 forks source link

widthUnit and radiusUnit not working during conversion to OpenLayers style #824

Open AlenKelemen opened 2 months ago

AlenKelemen commented 2 months ago

Description

I am trying to use widthUnit and radiusUnit properties set to 'm' when converting Geostyler styles to OpenLayers styles. However, it seems that these properties are not working as expected, and the resulting OpenLayers style does not reflect the intended units.

Expected behaviour

The converted style in OpenLayers should apply the correct units (e.g., meters) for width and radius properties, when widthUnit ,radiusUnit set to 'm'

How to reproduce


const geostylerStyle = {
  name: 'example',
  rules: [
    {
      name: 'rule 1',
      symbolizers: [
        {
          kind: 'Circle',
          radius: 10,
          radiusUnit: 'm',
          color: '#FF0000'
        }
      ]
    }
  ]
};

const olParser = new GeoStylerOpenlayersParser();
 return olParser.writeStyle(geoStylerStyle)
    .then(({ output: olStyle }) => olStyle)

### Possible Solution

Is there a known limitation regarding widthUnit or radiusUnit properties in the conversion process? If this feature is not implemented, are there any suggested workarounds?

### Additional Context

 versions:

"geostyler-openlayers-parser": "^5.0.0",
 "ol": "^10.1.0",
jansule commented 1 month ago

Thanks for the info @AlenKelemen. The unit properties are currently not supported in the openlayers parser. Adding support for this would be a great improvement. Are you planning on providing a PR for this?

PS: I will move this issue to the geostyler-openlayers-parser repository, since it is an issue with that parser.