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.


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 openlayers.org/dev/examples/ is a good resource for openlayers code snippets.

|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.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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