To highlight an area on my map I need to make a circular hole in a polygon. The rectangle polygon covers the whole map, the circle hole should act as a spot on my area to highlight.
But actually I only manage to make a rectangle hole, for example using Polygon's appendLinearRing function:
mypolygon.appendLinearRing(new ol.geom.LinearRing([
[239850, 5069850],
[239850, 5070150],
[240150, 5070150],
[240150, 5069850],
[239850, 5069850]
]));
The problem is that I can't find out how to add "Circle" as optional geometry (opt_layout) to ol.geom.LinearRing. Any hints?
Best Answer
I guess you create a Circle using the ol.geom.Circle(center, opt_radius, opt_layout) contructor api doc here. And then you want to update the polygon geometry with this circle. Right???
If so you can create the coordinates of your circle and pass these coords to appendLinearRing function.
You may do that as: (I havent test. Minor bugs may exist)