[OpenLayers-Users] custom units measure

Dimitrios Sferopoulos d.sferopoulos at ed.ac.uk
Tue Nov 27 04:43:42 PST 2012


Hi all,

I'm trying to add a custom measurement unit in OpenLayers 2.12. All that 
is available by default in OpenLayers is:

displaySystemUnits: {
   geographic: ['dd'],
   english: ['mi', 'ft', 'in'],
   metric: ['km', 'm']
}

I would like to be able to extend this and add a custom one to measure 
in miles only. For example, if measurement is less than 1 mile, say half 
a mile, display it as 0.5.

I don't want to go as far as editing the actual OpenLayers 
Measurement.js by adding the following as it is not scalable for future 
upgrades:

myCustomUnits: ['mi', 'mi']

Any ideas how I can extend OpenLayers to do the above?

Thanks Dimitrios

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the Users mailing list