Don't know, why the error occurs. But I simplified the resulting features. I 
think you want only polys not multipolys in the new features.
I also added a clone(), if there is a problem that you reuse the geometry 
objects from the removed features.
I'm not sure if it helps against the error. It seems to be something with the 
format.

                        for(f in MPolyFeature) {
                                for(i in MPolyFeature[f].geometry.components) {
                                        var feature = new 
OpenLayers.Feature.Vector(MPolyFeature[f].geometry.components[i].clone());
                                        feature.attributes.typ = 
MPolyFeature[f].attributes.typ;
                                        feature.attributes.tst = 
MPolyFeature[f].attributes.tst;
                                        feature.state = OpenLayers.State.INSERT;
                                        features.push(feature);
                                }                               
                        }
                        
                        wfs_polygon.addFeatures(features);
                        wfs_mpolygon.removeFeatures(MPolyFeature);
                        wfs_polygon.redraw();



Am 21.09.2012 11:01, schrieb vGIS:
Looks like the for-loop wasn't okay, I changed it to:

                        for(f in MPolyFeature) {
                                for(i in MPolyFeature[f].geometry.components) {
                                        var feature = new 
OpenLayers.Feature.Vector(new
OpenLayers.Geometry.Polygon(MPolyFeature[f].geometry.components[i])
                                        feature.attributes.typ = 
MPolyFeature[f].attributes.typ;
                                        feature.attributes.tst = 
MPolyFeature[f].attributes.tst;
                                        feature.state = OpenLayers.State.INSERT;
                                        features.push(feature);
                                }                               
                        }
                        
                        wfs_polygon.addFeatures(features);
                        wfs_mpolygon.removeFeatures(MPolyFeature);
                        wfs_polygon.redraw();
                }

But, that causes an Error: "TypeError: a is undefined ...function(a){var
b=this.createElementNSPlus("gml:interior");this.writeNode("Linea... in
OpenLayers.js Line 383"



--
View this message in context: 
http://osgeo-org.1560.n6.nabble.com/Multipolygon-to-Polygons-tp5003436p5003483.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



--
--------------------------------------------------
Slawomir Messner
Forschungszentrum "Deutscher Sprachatlas"
06421-28-24981

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to