Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a question how i can change this code

selectedFeature = feature;
popup = new OpenLayers.Popup.FramedCloud("chicken", 
  null, null, onPopupClose);
feature.popup = popup;

to make the center point of popup window exactly where I've clicked, not like it is now on the center of object bounds?

Thanks in advance.

share|improve this question

I have a not tested proposition :

1 - From that example you will be able to get coordinates from click -see also that example.

2 - You will, then be able to convert coordinates to pixel, with that function.

3 - Finally, you move the popup with popup.moveTo(new OpenLayers.Pixel(xxx));.

You probably have to calculate it before, regarding popup width and height. With the help of jQuery it can even be dynamic.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.