[OpenLayers-Users] How to handle a GeometryCollection Feature

Max Weidemann max.weidemann at freenet.de
Tue Aug 25 09:00:02 EDT 2009


Hi everybody

my problem is that i dont know how i could at a new geometry to an
GeometryCollection-Feature wich exists in an Vector layer.

i have added the collection to the layer in a way like this: 
 
var gc_geometry = new OpenLayers.Geometry.Collection(
              [
                new OpenLayers.Geometry.Point( 1379550.27259943,
6678794.95971749),
                new OpenLayers.Geometry.LineString( [p1,p2,p3] ),
                new OpenLayers.Geometry.Polygon([
                         new OpenLayers.Geometry.LinearRing([
                                new
OpenLayers.Geometry.Point(1378491.75288927, 6678659.00305747),
                                new
OpenLayers.Geometry.Point(1378491.75288927, 6679154.27374754),
                                new
OpenLayers.Geometry.Point(1379161.82499937, 6679154.27374754),
                                new
OpenLayers.Geometry.Point(1379161.82499937, 6678659.00305747),
                                new
OpenLayers.Geometry.Point(1378491.75288927, 6678659.00305747)])
                // etc.
              ])
            ]);

            var gc_feature = new OpenLayers.Feature.Vector( gc_geometry );

            vectorLayer.addFeatures( [ gc_feature ] );

>>> In other function i would like to add or remove some of the components

i get the feature with code like this:
       var feature = layer.getFeatureById(id);


At this Point i do not know what is the smartest way to add or remove some
components to the geometrycollection??
Im no so good in JavaScript and thankfull for any help!

cheers 
Max


-- 
View this message in context: http://n2.nabble.com/How-to-handle-a-GeometryCollection-Feature-tp3509578p3509578.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list