Skip to content

GeoJSON layer with several styles, only uses one of them #340

@Unraveler

Description

@Unraveler

This is related to the GeoJSON serializer.

If a layer has two styles, only one of them will be used.

e.g.

style": {
  "0": {
    "fillColor": "#000000",
    "fillOpacity": 0,
    "strokeColor": "#96d361",
    "strokeDashstyle": "5 5",
    "strokeOpacity": 1,
    "strokeWidth": 2
  },
  "1": {
    "fillColor": "#000000",
    "fillOpacity": 0,
    "strokeColor": "#ff0000",
    "strokeDashstyle": "5 5",
    "strokeOpacity": 1,
    "strokeWidth": 2,
     "strokeDashoffset": 5
  }
}			},

only one of this styles will be used for printing. Actually is the one that is defined in the GeoJSON feature properties:

"properties": {
  "_style": 1,
  ...
}							},

I tried to add it as "0 1", [0, 1], or ["0", ",1"], but it didn't work, resulting in the same or no rendering of the feature at all.

A found solution for it is to actually render the same element as many times as there are a style, but that is a very poor and dumb solution in my opinion. There has got to be a better way to handle this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions