Does anyone know how to change the QGIS Web Client measure tool (distance and area) so that it shows feet or miles rather than meters?
2 Answers
you have to change some code in qgis-web-client / site / js / WebgisInit.js
you can add unit
parameter to OpenLayers.Control.Measure
method. you have to do this for polygon too...
measureControls = {
line: new OpenLayers.Control.Measure(
OpenLayers.Handler.Path, {
persist: true,
units:'ft',
handlerOptions: {
layerOptions: {styleMap: styleMapMeasureControls}
}
}
)
other units are ‘degrees’ (or ‘dd’), ‘m’, ‘ft’, ‘km’, ‘mi’, ‘inches’..
i hope it helps you....
-
Thanks for the quick reply. Unfortunately this doesn't work for me under Linux Mint 12. I even went so far as to download the latest QGIS Web Client code and re-configure. The measure distance tool still shows units in meters and kilometers rather than feet and miles. In a perfect world, QGIS Web Client would use the same units as the coordinate system. Or at least it should be configurable inside GlobalOptions.js. BTW, I changed the units from 'degrees' to 'ft' inside GlobalOptions.js and still no go. Any other suggestions?– RaynerMay 18, 2012 at 19:18
I had this same problem. You'd think just changing the units would do it but it doesn't. You need to set the 'displaySystem' option to switch to "American Metric/SAE", aka 'english'.
measureControls = {
line: new OpenLayers.Control.Measure(
OpenLayers.Handler.Path, {
persist: true,
units:'ft',
displaySystem: 'english',
handlerOptions: {
layerOptions: {
styleMap: styleMapMeasureControls
}
}
}),
polygon: new OpenLayers.Control.Measure(
OpenLayers.Handler.Polygon, {
persist: true,
units:'ft',
displaySystem: 'english',
handlerOptions: {
layerOptions: {
styleMap: styleMapMeasureControls
}
}
})
};