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

Thanks to Nicklas' anwer to my previous question...
I was able to "combine my shapefile and CSV data have made a lot of progress on my project.

Now I want to display the attribute data in a popup when I either click or hover over a country.... I've done some goggling and looked at some examples but can't seem to make what I've seen work....
Can someone recommend a link or example I can look at?
I'm using mapserver and openlayers

Let me know if you'd like to see my script please let know


share|improve this question
up vote 6 down vote accepted

I'd suggest checking this openlayers example: getfeatureinfo-control. It shows the feature info in a table on the page. Putting it into a popup should be easy changing some lines in the javascript.

In general is a good resource for openlayers code snippets.

share|improve this answer
Thanks for the link!! I followed one of the OL examples and got the pop-up box the shows up!! The problem I'm now having is the box wont close.... When each time I click on the x in upper right corner of a box, another pop-up box appears.... I can figure out whats happening!! Any ideas as to a sol'n would be gratefully appreciated!! Chris – ChrisJ Dec 1 '10 at 14:56

Is it possible that you are calling your popup creation function in the closeBoxCallback parameter? This is a snippet from some code I was working on:

      popup = new OpenLayers.Popup.FramedCloud(
             new OpenLayers.Size(300,150),

The last null is in the place where you would put a callback function when the closeBox on the popup is clicked. In what I've displayed above, this is set to null and therefore, nothing is called and the popup doesn't reappear.

I saw in the "Open Popup on Layer.Vector" example in the OL Examples that there's a callback function here "onPopupClose". That unselects the feature which also I believe calls the onFeatureUnselect, which in turn destroys the popup. That is all setup in this line of that example:

selectControl = new OpenLayers.Control.SelectFeature(polygonLayer, {onSelect: onFeatureSelect, onUnselect: onFeatureUnselect});

So, it sounds like you need to either take out the closeBoxCallback in your popup creation (i.e. set it to null) or do something similar to this example that destroys the popup a bit later in the process.

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.