[OpenLayers-Users] How to Set Feature Id When creating Features programmatically

Eric Lemoine eric.lemoine at camptocamp.com
Wed Aug 3 01:57:08 EDT 2011


On Mon, Jul 25, 2011 at 12:13 PM, kapuch <kapusta.marcin at gmail.com> wrote:
> Hi Everybody.
>
> I'm looking for answer how to set feature id.
>
> I'm creating feature like this:
>
> var f = new OpenLayers.Feature.Vector(
>              new
> OpenLayers.Geometry.Point(15.24346,52.72433).transform(geographic,
> mercator),
>              {
>                title: "nananana",
>                description: "lalalala"
>              }
>            );
>
> and then trying to set the id property on the object.
>
> f.id = "my-featureid-1";
>
> But when I add this to the layer the feature id is for example:
> <image id="OpenLayers.Geometry.Point_189" ... cursor="pointer"></image>
>
> Is there any way to change the featureId?

Have you tried f.geometry.id = "your_id" ?



-- 
Eric Lemoine

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com


More information about the Users mailing list