terrestris / mapfish-print-manager

Generate MapFish print requests with an OpenLayers map

Home Page:https://terrestris.github.io/mapfish-print-manager/latest/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GeoJSON layer with several styles, only uses one of them

Unraveler opened this issue · comments

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.