[OpenLayers-Users] Mouse events on tiles

Chris Holmes cholmes at opengeo.org
Sun May 3 11:32:15 EDT 2009


I'm not sure if they're doing it for the wikipedia layer, but one 
technique I believe Google uses is to use an html image map instead of 
javascript for onclick and mouseover events.  I'm not sure exactly how 
that would interact with a tile cache, but I imagine it should, and 
that's probably how Google is doing it.

See http://geoserver.org/display/GEOS/HTML+ImageMap+support and 
http://mapserver.org/output/imagemaps.html

Though maybe performance would be fast enough checking with javascript, 
there probably is a correct way to do that for what you want to do.

Chris

tim robertson wrote:
> Hi all,
> 
> I am trying to reproduce with openlayers, the same effect that
> maps.google.com has with overlaying wikipedia articles.  I have a TMS
> layer, rendering the tiles server side and also have a web service
> providing the info about the pixels on the tile the features are (just
> like how google wikipedia overlay works).  I am not that great a
> Javascript and have been trying to work out where to attach mouseover
> and onclick events to the Image Tiles but have not succeeded.  I will
> need to detect mouseover and mouseout to make sure that I am not
> checking against the features for the whole map as the cursor moves
> over tiles as this would be much data to check.  While a cursor is on
> a tile I was planning to check the data array and see if the cursor
> was over a feature.
> 
> Can someone please advise me where best to attach mouse events to
> individual tiles?  I have been playing with various options, all of
> which got messy quickly - currently I am trying to subclass
> OpenLayers.Layer.TMS and modifying addTileMonitoringHooks.  Is this
> the correct way to proceed?  Any advice is greatly appreciated.
> 
> Many thanks,
> 
> Tim
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Chris Holmes
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list