[OpenLayers-Users] Mouse events on tiles

João Duarte joao.c.duarte at co.sapo.pt
Sun May 3 11:49:35 EDT 2009


Chris, in the past, Google Maps did it with image maps. But now, they only
use image maps for the search results markers. For the other layers
(YouTube, Wikipedia, Photos) they use the technique described by Tim.

One way to confirm that is to turn on one of those layers and then
disconnect yourself from the internet. You'll no longer be able to click on
the features because a request can't be made to know where the features are
on that tile.

João Duarte
SAPO Mapas - http://mapas.sapo.pt

-----Mensagem original-----
De: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Em
nome de Chris Holmes
Enviada: domingo, 3 de Maio de 2009 16:32
Para: tim robertson
Cc: Users at openlayers.org
Assunto: Re: [OpenLayers-Users] Mouse events on tiles

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.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list