2

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 2

2

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....

1
  • 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?
    – Rayner
    May 18, 2012 at 19:18
1

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
                }
            }
        })
    }; 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.