Search code examples
openlayers-3polygons

Cut holes into OpenLayers3 polygons (subtract)


The old version of OpenLayers supports cutting holes into polygons. See donut example.

I am unable to find examples or documentation regard this feature for OpenLayers3.

How do I cut holes into OpenLayers3 polygons?


Solution

  • Use the appendLinearRing(linearRing) function. http://openlayers.org/en/v3.3.0/apidoc/ol.geom.Polygon.html#appendLinearRing