[OpenLayers-Users] Caputing left click when displaying google maps

Eric Lemoine eric.c2c at gmail.com
Sun Aug 10 14:37:04 EDT 2008


Hi. This is weird. Do you observe the same with the mousedown event? Eric

2008/8/10, John Preston <byhisdeeds at gmail.com>:
> Hi, I have the following code using OpenLayers 2.6 but I can't get the
> left mouse click event to work with the google layers.
>
> map.addControl(new OpenLayers.Control.LayerSwitcher());
> map.addControl(new OpenLayers.Control.MousePosition());
> map.addControl(new OpenLayers.Control.OverviewMap());
> var gsat = new OpenLayers.Layer.Google(\"Google Satellite\", {type:
> G_SATELLITE_MAP});
> map.addLayers([gsat]);
> map.setCenter(new OpenLayers.LonLat(-77.4, 18.2), 9);
> map.events.register('click', map, function (e) {var lonlat =
> map.getLonLatFromViewPortPx(e.xy);alert('You clicked near ' +
> lonlat.lat + ' N, ' + lonlat.lon + ' E');})
>
> Clicking the left mouse button does nothing. The code however works if
> I use some other wms server layer.
>
> Any ideas what I'm doing wrong?
>
> John
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list