I need to set the rotation on a print task. Anyone know how? I'm about to hack the bloody thing and make the call myself, but there must be a better way. The WebMap JSON is simply missing the Rotate attribute. I just can't seem to intercept it before it chucks it up to my server. Any thoughts are greatly appreciated.
Solved! Go to Solution.
This works but there must be a better way.
*Esri - your Web Map as JSON in _setPrintParams(a) doesn't pick up rotation.
I subclass the EsriPrintTask and insert the rotation in the string-a-fied map json. I probably should insert it with something other than a string replace, but this works for now.
var CustomPrintTask = EsriPrintTask.createSubclass({
execute: function (a, b) {
internalPrintPrams = this._setPrintParams(a);
internalPrintPrams.Web_Map_as_JSON = internalPrintPrams.Web_Map_as_JSON
.replace(/mapOptions":{/gi,'mapOptions":{"rotation": -' + a.view.rotation.toString() + ',');
return this._geoprocessor["async" === this.mode ? "submitJob" : "execute"](internalPrintPrams, b)
.then(this._handleExecuteResponse)
}
});
me.myPrintTask = new CustomPrintTask();
me.myPrintTask.url = printUrl;
me.myPrintTask.mode = "async";
me.myPrintTask.execute(prntPrms).then().otherwise();
How are you guys getting that cool "code" formatting with the line numbers?
And, do we really have to obfuscate the SDK? Dang, it makes debugging hard in the late evening.
This works but there must be a better way.
*Esri - your Web Map as JSON in _setPrintParams(a) doesn't pick up rotation.
I subclass the EsriPrintTask and insert the rotation in the string-a-fied map json. I probably should insert it with something other than a string replace, but this works for now.
var CustomPrintTask = EsriPrintTask.createSubclass({
execute: function (a, b) {
internalPrintPrams = this._setPrintParams(a);
internalPrintPrams.Web_Map_as_JSON = internalPrintPrams.Web_Map_as_JSON
.replace(/mapOptions":{/gi,'mapOptions":{"rotation": -' + a.view.rotation.toString() + ',');
return this._geoprocessor["async" === this.mode ? "submitJob" : "execute"](internalPrintPrams, b)
.then(this._handleExecuteResponse)
}
});
me.myPrintTask = new CustomPrintTask();
me.myPrintTask.url = printUrl;
me.myPrintTask.mode = "async";
me.myPrintTask.execute(prntPrms).then().otherwise();
How are you guys getting that cool "code" formatting with the line numbers?
And, do we really have to obfuscate the SDK? Dang, it makes debugging hard in the late evening.