[OpenLayers-Users] Question about OpenLayers.Layer.Vector.addFeatures()

Max Demars burton449geo at gmail.com
Tue Aug 26 11:08:20 PDT 2014


I have noticed that the addFeatures() of the OpenLayers.Layer.Vector add a
lot of features and not just the feature that we pass to the function:

    var vectorLayer = new OpenLayers.Layer.Vector('Feature');

    var geoJson = new OpenLayers.Format.GeoJSON();

    var geojsonString = "{ "type": "MultiPolygon", "coordinates": [ [ [ [
-309443.24, 388111.57 ], [  -239422.23, 395845.01 ], [ -136320.43,
389768.69 ], [ -136320.43, 389768.69 ], [ -134666.39, 239616.41 ], [
-308616.22 ,238788.81 ], [ -309443.24, 388111.57 ] ] ] ] }"

    vectorLayer.addFeatures(geoJson.read(geojsonString);

    console.log(vectorLayer.features) // returns 13 objects instead of 1

13 features were added to vectorLayer.features. The first object is the
geoJson feature and the others are some points vector. Is this normal? If
yes, is it possible to not add those additional features because render
time is affected.

-- 
Stack Overflow: http://stackoverflow.com/users/1914034/burton449
GIS Overflow: http://gis.stackexchange.com/users/14426/burton449
LastFm: http://www.lastfm.fr/user/burton449
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20140826/657c9760/attachment.html>


More information about the Users mailing list