Apply hash pattern to polygon in openlayers

I am creating a vector layer consisting of polygons from a KML file using Openlayers, and I need to apply a hash pattern (diagonal strip) to the polygons. I know that Openlayers does not support adding a background image to a polygon in a vector layer, but I am wondering if anyone has any ideas on how to do this? The styling of the vector polygon is apparently limited by solid colors and opacity. If necessary, I will extend OpenLayers to add this functionality by manually creating hash strings within the boundaries of the polygon, but I hope someone has a simpler sentence before I go down this road.

+6
source share
2 answers

Using SLD, this can now be done. Not sure if this is in version 2.11 or in trunk development, but I noticed that the Example addition

enter image description here

+5
source

I have not tried this yet, but I have a similar problem.
The solution I will try is the svg template.
OpenLayers has SVG.js, which is used to draw polygons. I will modify this to support templates.
View image →
http://i2.aijaa.com/b/00653/9707550.jpg
In this example, I demonstrated the example http://openlayers.org/dev/examples/behavior-fixed-http-gml.html to demonstrate the use of the template. → Could this be a good solution?

+1
source

Source: https://habr.com/ru/post/909091/


All Articles