[OpenLayers-Users] OL 2.7 measure control questions

Tim Schaub tschaub at opengeo.org
Wed Jan 14 19:12:00 EST 2009


Zer wrote:
> Dear list,
> 
> Is there a way to change to mouse pointer to a hair cross when using then
> measure control?
> 

control.events.on({
     activate: function() {
         map.div.style.cursor = "crosshair";
     },
     deactivate: function() {
         map.div.style.cursor = "default";
     }
});

Of course you'll be better off if you use methods like:

OpenLayers.Element.addClass(map.div, "cursor_cross");

and

OpenLayers.Element.removeClass(map.div, "cursor_cross");

And then load up a stylesheet that has something like

.cursor_cross {
     cursor: crosshair;
}

> Is there a way to always present the measured distance in meters? The
> distance shows in km as soon as a distance longer than 1000m is measured.
> 

var control = new OpenLayers.Control.Measure(OpenLayers.Handler.Path, {
     displaySystemUnits: {metric: ["m"]}
});

This property (displaySystemUnits) is not marked as part of the API - so 
you may have to change your app if it changes (don't imagine it will in 
2.x).

Tim

> Thanks,
> 
> Z


-- 
Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.



More information about the Users mailing list