Let's assue you have only the one MultiPolygon in your layer.
var mpolygon = wfs_mpolygon.features[0];
var c = null;
for (c in mpolygon.geometry.components) {
var poly = mpolygon.geometry.components[c];
doSomethingWith(poly);
}
Be aware that mpolygon is an instance of OpenLayers.Feature.Vector class
and poly an instance of OpenLayers.Geometry class (in your case
OpenLayers.Geometry.Polygon). You can find the description of the
classes at
http://dev.openlayers.org/releases/OpenLayers-2.12/doc/apidocs/files/OpenLayers-js.html.
There you can see, that an MultiPoligon inherits the OL.Geom.Collection
class and this class has a components attribute where it stores all the
geometries, you can learn all this by reading the api.
Regards
Slawomir
Am 21.09.2012 09:48, schrieb vGIS:
Some Polygons were added to a MultiPolygon:
// add Polygons to a MultiPolygon
function cmd_Poly_add() {
var features = wfs_polygon.selectedFeatures;
var polygons = [];
var f = null;
for( f in features) {
polygons.push(features[f].geometry);
}
var myCombinedFeature = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.MultiPolygon(polygons));
myCombinedFeature.state = OpenLayers.State.INSERT;
wfs_mpolygon.addFeatures([myCombinedFeature]);
wfs_polygon.removeFeatures(features);
wfs_mpolygon.redraw();
}
*How do I splitt the Multipolygon-features to several Polygon-features, that
have the same attributes (typ and tst)?*
--
View this message in context:
http://osgeo-org.1560.n6.nabble.com/Multipolygon-to-Polygons-tp5003436.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users