Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have shapefile polygons. I'm using OpenLayers with OpenStreetMap tiles. Is it possible to create hover effect which will show up info window with some informations about that polygons? Is it the best to put it in some database maybe? Thank you.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

SelectFeature popup. Example can be easily changed to Hover instead of Select

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

different way to do popups

http://dev.openlayers.org/releases/OpenLayers-2.12/examples/popupMatrix.html

Select with a hover (but no info box)

http://dev.openlayers.org/releases/OpenLayers-2.12/examples/select-feature.html

...all the reference are there, you'll just need to put the pieces together.

share|improve this answer
    
Ok, thank you. I have one more question. If I would need to add one more shapefile with roads on the top of the map (over layer with those shapefiles), would that selectfeature popup still be working? –  againstflow Aug 13 '12 at 17:44
    
Shapefiles don't work on OL. You'll have to convert (e.g. KML) or publish somewhere (e.g. ArcGIS). The new select handlers accept an Array of layers. So as long as the features aren't stacked you can click multiple layers. If they are stacked - search for "clustering" here or online –  Vadim Aug 13 '12 at 17:46
    
Ok, great, I have KMLs, too. No, roads shapefile would be line, and those shapefiles with popups would be polyongs. Polygons would be overlayed with lines. Is there a way to organize text in popups considering I have four informations for every polygon (name, address, url, etc)? That would need to be shown one under another so what is the best way to show it in popup? –  againstflow Aug 13 '12 at 17:50
    
I thought popups used conventional html and css for layout and styling. –  Michael Markieta Aug 13 '12 at 18:01

Your Answer

 
discard

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.