[OpenLayers-Users] get the values from controls
Christopher Schmidt
crschmidt at metacarta.com
Thu Sep 10 09:35:45 EDT 2009
On Thu, Sep 10, 2009 at 08:26:27AM -0500, sunny74 wrote:
>
> Dear Friends,
>
> I want to have the lonlat from the mouseover event.
> For this I have written the following code for trapping the event,
>
> map.events.register("mouseover", map, function(e) {
> var lonlat1 = map.getLonLatFromViewPortPx(e.xy);
> //alert(lonlat1);
> var txt1 = document.getElementById('Hidden1');
> txt1.value = lonlat1;
>
> });
>
> But I find that the lonlat value that comes,does come in a jerky fashion i.e
> lonlat value doesn't come in a continuous manner with every movement of the
> mouse.
>
> In order to tackle the problem it would be better to get the value from the
> MousePosition Control.
> Does anyone know how to get the value from this control?
You want the 'mousemove' event, not the mouseover event (which only
fires when you enter or exit a div; your 'jerkiness' comes from crossing
over non-visible tile borders).
> Similarly how to get the layer names from the LayerSwitcher control?
for (var i = 0; i < map.layers.length; i++) {
alert(map.layers[i].name);
}
> How to manipulate the LayerSwitcher so that it shows only the layers at a
> particular zoom level and not all the layer groups at the same time?
This is not possible in OpenLayers at this time.
-- Chris
>
> Thanks for ur reply.
> --
> View this message in context: http://n2.nabble.com/get-the-values-from-controls-tp3617395p3617395.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
--
Christopher Schmidt
MetaCarta
More information about the Users
mailing list