Print task scale bar accuracy question

3724
16
Jump to solution
06-10-2013 07:52 AM
MikeKillion
New Contributor II
Hello,
I'm using the print task in v3.5 to output a pdf. The scalebar on the pdf is not accurate however, it's about 0.3 miles short when compared to section lines on the map (see attached pdf). I'm using the preserveScale = true option. I have the scalebar units set to miles, and have experimented with setting the units of the basemap as well - nothing makes an improvement.

Any thoughts?

Thanks
0 Kudos
16 Replies
BenFousek
Occasional Contributor III
@ben
i dont think thats actually correct.  its my understanding that the projection of the print output will be determined by the spatial reference which is passed within the WebMapJSON.


Yep. And here I had been using that reasoning for a couple of print tasks. Will be spending the day fixing that with an extent reprojection.
0 Kudos
BenFousek
Occasional Contributor III
Will be spending the day fixing that with an extent reprojection.


Already taken care of. Set outSpatialReference of esri.tasks.PrintParameters.
0 Kudos
JohnGravois
Frequent Contributor
excellent.  thanks for sharing!
0 Kudos
MikeKillion
New Contributor II
I was already setting the outSpatialReference when I was seeing the problem. It's set to 102100 to match the web map. Are you saying it should be set to match the spatial reference of the dataframe in the template mxd?
0 Kudos
JohnGravois
Frequent Contributor
i think Ben is suggesting setting the outSpatialReference to a coordinate system which accurately portrays distance.
0 Kudos
BenFousek
Occasional Contributor III
Yes. You can output in any spatial reference you would like. So if your data is in some state plane projection you can set outSpatialReference to that projection and that will be what is output.

My mistake was thinking that if I set the projection of the data frame in the template it would output in that projection, but the print task overrides it. Foolishly I didn't test that theory. Setting outSpatialReference fixed it and I'm getting accurate scales.

If outSpatialReference is not set it uses the map's projection (102100).

You may also want to set preserveScale to false if your output has different units (feet not meters); else the extent of the output will be different than the map.
var template = esri.tasks.PrintTemplate(); template.preserveScale = false;
0 Kudos
MikeKillion
New Contributor II
That did it - I misunderstood what outSpatialReference did.

Thanks guys!
0 Kudos