Alexandre,


Thanks for the help!  After a bit of fiddling, I'm not plotting my own features 
on the map and getting the pop-ups to work.  I started with the sample code and 
hacked that up a bit. At this point, I'm still not sure why it's working, but 
since it is, investigation is much easier.



I spent some time understanding the source for OpenLayer.Handler.Point and 
family; that was very helpful.  My complements to the authors (not sure if 
that's you), OpenLayers is very well thought-out & implemented.





Regards,

gene



-----Original Message-----
From: Alexandre Dube [mailto:[email protected]]
Sent: Friday, January 16, 2009 10:50 AM
To: Gene Sally
Cc: [email protected]
Subject: Re: [OpenLayers-Users] Understanding layers and popups



Hi Gene,



Did you look this example :

http://openlayers.org/dev/examples/select-feature-openpopup.html



What you're trying to do seems to be displayed there.



You should also look at the draw features example :

http://openlayers.org/dev/examples/draw-feature.html



Also, your vector layer must be on top of all others for this to work.

Or, layers on top must not be visible or not inRange.



Best of luck,



Alexandre



Gene Sally wrote:

> Hi,

>

> I've been slogging through getting this to work (my map renders on the page 
> now) and I'm having trouble getting my head around how layers and the 
> click/hover callbacks work.  The goal is to get a popup working on arbitrary 
> points added to the map.

>

> I have a map with an Image baselayer and a Vector layer where the features 
> have been added, like so

>

> var newPoint = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point());

> var lonlat = map.getLonLatFromPixel(new OpenLayers.Pixel(x,y));

> newPoint.geometry.x = lonlat.lon;

> newPoint.geometry.y = lonlat.lat;

> targetLayer.drawFeature(newPoint, 
> OpenLayers.Util.extend(OpenLayers.Feature.Vector.style['default'], {}));

>

> So far so good!  The points appear in the targetLayer as expected.  (But, 
> when I use the zoom control, they don't zoom with the map, but that's another 
> day's problem...)

>

> I added a OpenLayers.Control.SelectFeature

>

> selectControl = new OpenLayers.Control.SelectFeature(

>                       targetLayer,

>                       {onSelect: onTargetSelect, onUnselect: 
> onTargetUnselect});

> selectControl.activate();

> map.addControl(selectControl);

>

> When click on a newPoint on the map, the reaction is like I'm selecting the 
> baselayer. What I can't figure out is how to make the targetLayer the active 
> layer, as from reading the mail logs, it appears like the SelectFeature works 
> for the active layer.  I've read/reread the sundials.html code (as that's 
> close to the affect I want) and can't figure out what I'm doing wrong.

>

> With Regards,

> gene

> _______________________________________________

> Users mailing list

> [email protected]

> http://openlayers.org/mailman/listinfo/users

>





--

Alexandre Dubé

Mapgears

www.mapgears.com


_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to