[OpenLayers-Users] Openlayers.Feature.Vector cloning

François Van Der Biest f.vanderbiest at gmail.com
Thu Feb 7 08:37:24 EST 2008


Hi list,

I'm showing some vector features on my map, which come from a GeoJson file.
In this GeoJson, features have an id, which is not a standard attribute ...
for instance:
{
"type": "Feature",
"id": "1",
"geometry": {
"type": "Point",
"coordinates": [613100, 2003000]
},
"properties": {
"post80": "true",
"precise": "true"
}
}

As a result, OL features inherit this id as a "fid" property.

For some reason, I have to clone these features.
I was surprised to see that "fid" property is not copied (it becomes "null"
in the cloned feature).

The reason lies around line 100 in Vector.js :
* Method: clone
* Create a clone of this vector feature. Does not set any non-standard
properties.

I guess I have no other solution to move the id parameter inside the geojson
"properties" object.

F.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080207/0e5248a2/attachment.html


More information about the Users mailing list