Polygon objects have an exterior ring and (optionally) multiple interior rings. With OpenLayers, when you create a Polygon object, the first Ring you provide is the exterior ring; the rest are the interior rings. If you had multiple "holes", you could add them.
Seems like you found out how to get it to do what you want, but I figured it wouldn't hurt to know "why" it works! A MultiPolygon would be used if you have multiple, independent polygons that you wanted grouped together; each polygon could have internal rings also, but each polygon would be a separate entity and wouldn't really affect the definition of the other polygons. You are correct that for what you need, a MultiPolygon isn't needed. Scott Brad Spencer wrote: > --> > > Ok, found out that if you just force two LinearRing geometries into the > same polygon object you get two polygons that are fused together as it > were. No need to use MultiPolygon! > > > > var parcel01= new OpenLayers.Geometry.LinearRing(pointList01); > > var parcel02 = new OpenLayers.Geometry.LinearRing(pointList02); > > var polygonFeature = new OpenLayers.Feature.Vector( new > OpenLayers.Geometry.Polygon([parcel01, parcel02])); > > > > At least it does what I want. > > > > Cheers, > > > > Brad… > > > > *From:* [email protected] > [mailto:[email protected]] *On Behalf Of *Brad Spencer > *Sent:* Tuesday, October 27, 2009 5:52 PM > *To:* openlayers users > *Subject:* [OpenLayers-Users] MultiPolygons > > > > List, > > > > I cannot see any examples of this so thought someone may have done the > and can help me. > > > > Its not clear how to make a multiPolygon vector object. I can create > individual polygons no problem but how for example would you generate > two concentric circles as a single polygon with no lines joining the > two circles? This would be is the same as a donut shape. > > > > Cheers, > > > > *Brad Spencer* > > NuMaps > > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Users mailing list > [email protected] > http://openlayers.org/mailman/listinfo/users _______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
