[OpenLayers-Users] OL 2.7 measure control questions

Tim Schaub tschaub at opengeo.org
Tue Jan 20 01:35:09 EST 2009


Hey-

Zer wrote:
> Thanks!
> 
> Cross hair works great!
> 
> But the meter/kilometer thing is still a problem. Even though i use
> 'displaySystemUnits: {metric: ["m"]}', the control gives the result in km if
> lenght is more than 1000 meters.
> 

Can you post a (relevant) bit of your application code?

Adding the following property to the options (second argument) of the 
measure control constructor should do the trick:

     displaySystemUnits: {metric: ["m"]}

Tim

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


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



More information about the Users mailing list