Select to view content in your preferred language

how to change scale bar unit from miles to feet using print widget

5570
4
01-29-2014 06:29 AM
LixianDai
Deactivated User
Hi, All,
What I did is using the print widget in the ArcGIS JavaScript Api to execute the map export to pdf.
But the issue is when I change the scale bar unit from default one (miles) to feet. Only the unit label changed but the number on the scale bar did not change along with the unit change.

I also test the scale bar unit change in an online sample http://developers.arcgis.com/javascript/samples/widget_print_webmap/

This is what I did.
var templates = new esri.tasks.PrintParameters;
    templates = [{
        label: "Layout-Landscape",
        format: "pdf",
        layout: "A4 Landscape",
        layoutOptions: {
            titleText: "Default Title",
            authorText: "NOTE:",
            scaleBarOptions: {
                metricUnit: "meters",
                metricLabel: "m",
                nonMetricUnit: "feet",
                nonMetricLabel: "ft"
            },
            scalebarUnit: "Feet"
        },
        exportOptions: {
            dpi: 96
        }
    }];

    // create the print dijit       
    printer = new esri.dijit.Print({
        "map": map,
        "templates": templates,
        url: ConfigPrintUrl
    }, dojo.byId("print_button"));
    printer.startup();


But it only change the unit label from miles to feet, not the real number on the scale bar.
Any one knows any solution?
Thank you very much.
0 Kudos
4 Replies
testtest5
Deactivated User
I'm facing the same problem. Is there a soultion for this?
0 Kudos
deleted-user-Jie3eyjOl9XM
Deactivated User
Yes, I'm facing the same problem.

The JavaScript scalebar will magically change from Miles to Feet as you zoom in and out. But, I can't get my exported map to do the same thing. I can determine the scale of my map for the Print Widget, and it would be nice to just tell the Print service which units to display.

I didn't see that scaleBarOptions parameter in documentation, through. Where did you find that?
0 Kudos
RogerDiercks
Deactivated User
I'm also a member of the club dealing with this scale bar unit issue. A custom layout template with a scale bar with units set to feet appears to be a workaround that works for my intended uses. My maps will almost always be printed at very large scales, so hardwiring feet as the scale bar units works fine for me. I created a local folder for my custom template, saved the MXD that defines my custom template there, and then followed the instructions below to publish an additional web printing service on my ArcGIS Server instance.

http://resources.arcgis.com/en/help/main/10.2/#/Tutorial_Publishing_additional_services_for_printing...
0 Kudos
JohnChurchill
Regular Contributor

I'm in this club now too. I'm also looking into making my own templates since these are so limited.

0 Kudos