[OpenLayers-Users] Selecting a feature - does not always work

Pierre GIRAUD bluecarto at gmail.com
Fri Nov 23 04:08:35 EST 2007


Looking at your problem, I just remembered having a similar problem.
In my example, the returned feature  argument did never change. It was
always the first clicked one.

Hum, you are using OpenLayers 2.4 !
This was fixed in the 2.5 version. Take a look at :
http://trac.openlayers.org/ticket/876

Regards,
Pierre

On Nov 22, 2007 2:42 PM, Eric Lemoine <eric.c2c at gmail.com> wrote:
> On Nov 22, 2007 1:01 AM, Nick Whitelegg <nick at hogweed.org> wrote:
> >
> > Hello everyone,
> >
> > Another problem relating to the 'osmajax' editor
> > (http://www.free-map.org.uk/freemap/javascript/osmajax-0.5/index.php - see my
> > last post). Selecting a feature does not always work - the feature always
> > goes blue but sometimes  the status message at the top does not read "you
> > selected a feature with ID xxxx". Tests in my code reveal that the variable
> > "selectedFeature" is not always set. My code to respond to a mouse click on a
> > feature:
> >
> >   this.selectUp = function (f)
> >     {
> >         if(f instanceof OpenLayers.Feature.OSM)
> >         {
> >             var item = f.osmitem;
> >             var msg;
> >             if(item.type != 'unknown')
> >                 msg = 'You selected a ' + item.type;
> >             else
> >                 msg = 'You selected an item of unknown type ';
> >             if(item.tags['name'])
> >                 msg += ' ('+item.tags['name']+')';
> >             msg += ' with an ID of ' + item.osmid;
> >             self.statusMsg(msg);
> >             self.selectedFeature = f;
> >         }
> >     }
> >
> > Any ideas what might be wrong here? Using openlayers 2.4.
> > The behaviour appears to occur randomly.
>
>
> Hi Nick,
>
> If your feature goes blue it means that the SelectFeature control did
> its job. If you don't get the expected message, I think it means
> there's a problem in your code. Could you provide more of your code so
> that we can try helping you out?
>
> Cheers,
> --
> Eric
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list