Scalebar on printed map inaccurate

2955
9
01-13-2016 12:38 AM
MihkelMänna
Occasional Contributor

I am using Larry Stout's PrintPlus widget together with my own printing service and templates to print maps in my application. My basemap and printing templates are in Web Mercator (wkid 3857), the PrintParameters are also set to match the map's spatial reference. However, the scalebars on my printed maps are inaccurate.

I'm aware that Web Mercator isn't the best projection for measuring distances etc, but is there a solution/workaround for this problem? Any help is appreciated.

0 Kudos
9 Replies
GirishYadav
Occasional Contributor

Mihkel,

PrintTemplate.preserveScale = true;

should solve this issue.

-Girish

MihkelMänna
Occasional Contributor

Girish,

Thanks for your answer but I actually already have it set to true.

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Any chance you have something hard set in the custom print service itself?

0 Kudos
LarryStout1
New Contributor II

Mihkel,

This is one of the reasons I hate Web Mercator.  Your only option is to use a different spatial reference for the printed map.  You may get away with doing that in the config.json for the PrintPlus widget.  Set the "outWkid" value to a spatial reference that will scale reliably (almost anything except Web Mercator).  BTW, it is possible to "calculate" the UTM Zone based on the longitude, at least for North America.

Larry

MihkelMänna
Occasional Contributor

Thanks, Larry!

This seems likely to work. I'll give this a try tomorrow. I don't recall hard setting or hard coding anything in the print service.

0 Kudos
MihkelMänna
Occasional Contributor

Larry,

Changing the "outWkid" value didn't resolve my problem. The scalebar remains unchanged whatever wkid I use. Changing the template's coordinate system doesn't work either. Any other ideas how to fix this?

Mihkel

0 Kudos
LarryStout1
New Contributor II

Basically, you have a map that is at a different scale in the East-West direction than it is in the North-South direction.  From that, you want to print a map with a scalebar.  I don't know of a way to do that without converting the map to a different Spatial Reference.  I was hoping the "outWkid" setting would do that for you.  I'm out of ideas.

0 Kudos
MihkelMänna
Occasional Contributor

Larry,

The problem seems to be the outspatialReference property for PrintParameters. This is set to the map's spatial reference in the widget, but I have Web Mercator for my spatial reference and it overrides all other spatial reference settings.

After changing the outspatialReference the scalebar seems to be accurate, but the layout boxes don't match the print results. How can I calculate appropriate sizes for my layout boxes now?

0 Kudos
ZhujingXia
Occasional Contributor II

Larry,

I used your PrintPlus widget. My map service is using State Plan. I change the  "outWkid": 2260, and also

"mapScales": [

     180000, 90000, 45000, 22500, 11275, 5600, 2800,

    1400, 700, 250

  ]

Which is matches the scale for my map. But the scale bar still shows the scale which is not my scale. Could you help?

Thanks

0 Kudos