I show over lon/lat my position with a icon(PIN) on the map....and I want to add a little popup to the marker with some GeoInfo like City and Country....but if I add a normal popup (new OpenLayers.Popup) it only appears on the top left corner of the page, but I want it at my position or next to my icon(Pin) on the map.... can anyone help or tell me what is wrong with my code....
like I said it only appears in the TOP LEFT Corner of the map.....and if I change markers.lonLat to new Openlayers.LonLat(5,40) no popup is shown.... and if I change new.Openlayers.Popup to new.Openlayers.Popup.AnchoredBubble oder new.Openlayers.Popup.Anchored no PopUp appers as well :( Any ideas?!?! asked 26 Oct '10, 08:28 BabyPowder Andy Allan |
I know that this is fairly old, but I thought I may as well answer it because it comes up a lot in general OpenLayers marker/popup searches quite a lot. Create a method to add the marker (I use addMarkers) and then within that, create a variable reference to each marker, var marker = new OpenLayers.Marker(ll, etc), then call the .lonlat property of that variable, rather than the layer itself. That way you know you're getting the appropriate projection and all. You might also want to make the popup a child of the marker, so that you can reference each marker's popup easily in the future. A nice example of popups can be seen here: http://openlayers.org/dev/examples/popupMatrix.html Check out the source code. It provides a lot of examples, and approaches it a bit differently, although more effectively I feel. answered 20 Apr '11, 06:38 mricci |
This is a help system for the OpenStreetMap project, but your question is quite a technical one regarding OpenLayers, which is an independent software project. If you don't get any other answers here, you would be better looking at the OpenLayers site for support queries. answered 26 Oct '10, 11:39 Andy Allan |
This can be closed....... somehow I did nothing different in my eyes but today exactly what I wanted to do worked for me....... this thread can be closed answered 29 Oct '10, 13:42 BabyPowder Andy Allan |
I am using the OpenStreetMap so I thought that I can ask my question here...... answered 26 Oct '10, 12:33 BabyPowder You can ask your question here, it's just more likely to get a helpful answer if you ask the people of OpenLayers. However note that your code never makes a connection between the individual marker and the popup. You're somehow trying to couple the markers layer and the popup instead of the marker and the popup. See the OpenLayers examples page for working code.
(26 Oct '10, 12:55)
Augustus Kling
Example 11 of http://php-baustelle.de/openlayers/step-by-step/ might also provide some guidance. However you should rework the variable scope.
(27 Oct '10, 07:08)
Augustus Kling
|