In OpenLayers, I create a polygon consisting of two LinearRing objects, using code of the form (this is in Java+GWT, but the same principle applies to JS):
List<LinearRing> linearRingList = new ArrayList<LinearRing>();
List<Point> points1 = new ArrayList<Point>();
... populate points1 ...;
linearRingList.add(new LinearRing(points1.toArray(new Point[points.size()])));
List<Point> points2 = new ArrayList<Point>();
... populate points2 ...;
linearRingList.add(new LinearRing(points2.toArray(new Point[points.size()])));
Polygon poly = new Polygon(linearRingList.toArray(new LinearRing[linearRingList.size()]));
VectorFeature feature = new VectorFeature(poly);
myLayer.addFeature(feature);
When I view this layer on a map, if the polygons defined by points1 and points2 overlap, I see a hole:
polygon hole http://www.jackhollow.co.uk/misc/polygon.png
I'm seeing the "xor" of the two polygons, where I want to see the "or" of them instead, ie with that hole in the middle filled in green.
How do I do this? I'm sure it's just a display issue in Openlayers, but I can't find a flag to control it anywhere.
The original two polygons are as:
polygon hole http://www.jackhollow.co.uk/misc/polygon2.png
if displayed together on a single layer they overlap, but Openlayers is not filling in the intersecting parts.