0

I am working with MapFish Print (v3.23.1) and have a mix of layers for a map, some from GeoServer and some local GeoJSON files. I have GeoJSON polygons that I would like to apply a hatch pattern to, but I can't find a way to do this. I am using the MapFish JSON Style Version 2, and tried to use the graphicName property with the value set to shape://backslash (I tried both inside and outside of brackets as this could be an ECQL expression) without luck. No errors, just doesn't apply. According to the documentation it looks as though that style may only apply to point geometry, which I don't quite understand. The documentation also mentions that SLD formatting is supported, but I can't figure out how to set that up in the request JSON. I tried setting style property equal to file://style.sld, and also to the SLD as a string; it ignores the file reference, and gives syntax error on the SLD string. I am pasting the portion of my JSON file below that includes the GeoJSON properties. Does anyone if it is possible to apply a hatch style to the polygons and if so how to do it?

"layers": [
                {
                    "type": "geojson",
                    "geoJson": "file://parcels_wind.geojson",
                    "style": {
                        "version": 2,
                        "*": {
                            "symbolizers": [
                                {
                                    "type": "polygon",
                                    "fillColor": "#8400a8",
                                    "fillOpacity": 0.1,
                                    "strokeColor": "#8400a8",
                                    "strokeOpacity": 1,
                                    "strokeWidth": 3,
                                    "graphicName": "shape://backslash"
                                },
                                {
                                    "type": "text",
                                    "fontColor": "#000000",
                                    "label": "[owner_id]",
                                    "labelAlign": "cm",
                                    "goodnessOfFit": 0.1,
                                    "spaceAround": 10,
                                    "fontFamily": "Arial Narrow",
                                    "fontSize": "8px",
                                    "fontStyle": "normal",
                                    "fontWeight": "bold",
                                    "haloColor": "#ffff00",
                                    "haloOpacity": 1,
                                    "haloRadius": 4
                                }
                            ]
                        }
                    }
                },

1 Answer 1

0

I found the answer here:

https://github.com/mapfish/mapfish-print/issues/899

Storing the SLD file with other template files and referencing the file location for the style property is what worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.