ESRI Javascript - Print Task GP Service - Symbology IssueDoes the esri javascript api Identify Task Return a...
Aliens crash on Earth and go into stasis to wait for technology to fix their ship
bldc motor, esc and battery draw, nominal vs peak
Is there any official lore on the Far Realm?
Checks user level and limit the data before saving it to mongoDB
How to not starve gigantic beasts
How exactly does Hawking radiation decrease the mass of black holes?
Can I criticise the more senior developers around me for not writing clean code?
How can Republicans who favour free markets, consistently express anger when they don't like the outcome of that choice?
Can someone publish a story that happened to you?
How to denote matrix elements succinctly?
A strange hotel
Is Diceware more secure than a long passphrase?
Implications of cigar-shaped bodies having rings?
"You've called the wrong number" or "You called the wrong number"
Re-entry to Germany after vacation using blue card
Can I grease a crank spindle/bracket without disassembling the crank set?
How do I check if a string is entirely made of the same substring?
Two field separators (colon and space) in awk
Can an Area of Effect spell cast outside a Prismatic Wall extend inside it?
How do I reattach a shelf to the wall when it ripped out of the wall?
Betweenness centrality formula
Minor Revision with suggestion of an alternative proof by reviewer
What happens to Mjolnir (Thor's hammer) at the end of Endgame?
Was there a shared-world project before "Thieves World"?
ESRI Javascript - Print Task GP Service - Symbology Issue
Does the esri javascript api Identify Task Return a FeatureSet?Generating vector geospatial PDF from ArcGIS Server servicesEsri Query Task service does not displayESRI geoprocessing service with Javascript API 3.5Modify Map Service Symbology via Esri JavaScript APISetting output parameter in Python script tool to be PDF?Legend item resolution issues in ArcGIS Javascript appLegend label failed to send to the print service using ArcGIS javascriptArcGIS JavaScript PrintTask Failed to create layer from service atJavascript syntax error on print map, only when feature count > 8000 (updated)
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I am using the ESRI js API, and using a python GP service to run a print task to PDF with custom layouts. This works great, except when i have any map service enabled in the map. The layer in the resulting PDF displays jumbo sized points, and I cannot figure out why or what to change. Thanks in advance for any advice!
printTask = new esri.tasks.PrintTask(printUrl, { //new instance of print job
async: false //our service is set to syncronous
});
params = new esri.tasks.PrintParameters(); //placeholder for our parameters to put in the script
params.map = map; //reference to the active map object
function print(){ //action to run when submit is clicked
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "none");
document.getElementById("printStatus").innerHTML = " Converting to PDF <img src='loader.gif'>";
var title = dijit.byId("title").get("value") //parameter[2]
var subtitle = dijit.byId("subtitle").get("value") //parameter[3]
var agent = dijit.byId("agent").get("value") //parameter[4]
var legendLayer = new esri.tasks.LegendLayer();
params.template = {
layout: mxdTemplate,
format: 'PDF',
preserveScale: false,
layoutOptions: {
legendLayers: []
}
};
params.outSpatialReference = map.spatialReference
params.extraParameters = {
Title: title,
Subtitle: subtitle,
Agent: agent
}; //the custom parameters for the python script
printTask.execute(params, printComplete, printError); //run the task, completion triggers 'printComplete' function, any error triggers printError
}
function printComplete(result){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
console.log(result.url);
document.getElementById("printStatus").innerHTML = "<a href='" + result.url + "' target='_blank'><b>Download PDF<b></a>" //link to the PDF
}
function printError(error){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
document.getElementById("printStatus").innerHTML = "An unexpected Error has occured <br>( " + error + " )<br> try saving again" //error warning popup
}
Python GP service
import arcpy
import os
import uuid
# Param 0 = INPUT JSON STRING
# Param 1 = OUTPUT FILE
# Param 2 = Layout Template
# Param 3 = Title
# Param 4 = Subtitle
# Param 5 = Agent
# Input WebMap json
Web_Map_as_JSON = arcpy.GetParameterAsText(0)
# The template location in the server data store
templateMxd = arcpy.GetParameterAsText(2)
title = arcpy.GetParameterAsText(3)
subtitle = arcpy.GetParameterAsText(4)
agent = arcpy.GetParameterAsText(5)
# Convert the WebMap to a map document
result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)
mxd = result.mapDocument
# Reference the data frame that contains the webmap
# Note: ConvertWebMapToMapDocument renames the active dataframe in the template_mxd to "Webmap"
df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0]
for elem in arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT"):
if elem.name == "Title":
elem.text = title
elif elem.name == "Subtitle":
elem.text = subtitle
elif elem.name == "Agent":
elem.text = agent
# Use the uuid module to generate a GUID as part of the output name
# This will ensure a unique output name
output = 'WebMap_{}.pdf'.format(str(uuid.uuid1()))
Output_File = os.path.join(arcpy.env.scratchFolder, output)
# Export the WebMap
arcpy.mapping.ExportToPDF(mxd, Output_File)
# Set the output parameter to be the output file of the server job
arcpy.SetParameterAsText(1, Output_File)
# Clean up - delete the map document reference
filePath = mxd.filePath
del mxd, result
os.remove(filePath)
javascript arcgis-javascript-api symbology pdf geoprocessing-service
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am using the ESRI js API, and using a python GP service to run a print task to PDF with custom layouts. This works great, except when i have any map service enabled in the map. The layer in the resulting PDF displays jumbo sized points, and I cannot figure out why or what to change. Thanks in advance for any advice!
printTask = new esri.tasks.PrintTask(printUrl, { //new instance of print job
async: false //our service is set to syncronous
});
params = new esri.tasks.PrintParameters(); //placeholder for our parameters to put in the script
params.map = map; //reference to the active map object
function print(){ //action to run when submit is clicked
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "none");
document.getElementById("printStatus").innerHTML = " Converting to PDF <img src='loader.gif'>";
var title = dijit.byId("title").get("value") //parameter[2]
var subtitle = dijit.byId("subtitle").get("value") //parameter[3]
var agent = dijit.byId("agent").get("value") //parameter[4]
var legendLayer = new esri.tasks.LegendLayer();
params.template = {
layout: mxdTemplate,
format: 'PDF',
preserveScale: false,
layoutOptions: {
legendLayers: []
}
};
params.outSpatialReference = map.spatialReference
params.extraParameters = {
Title: title,
Subtitle: subtitle,
Agent: agent
}; //the custom parameters for the python script
printTask.execute(params, printComplete, printError); //run the task, completion triggers 'printComplete' function, any error triggers printError
}
function printComplete(result){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
console.log(result.url);
document.getElementById("printStatus").innerHTML = "<a href='" + result.url + "' target='_blank'><b>Download PDF<b></a>" //link to the PDF
}
function printError(error){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
document.getElementById("printStatus").innerHTML = "An unexpected Error has occured <br>( " + error + " )<br> try saving again" //error warning popup
}
Python GP service
import arcpy
import os
import uuid
# Param 0 = INPUT JSON STRING
# Param 1 = OUTPUT FILE
# Param 2 = Layout Template
# Param 3 = Title
# Param 4 = Subtitle
# Param 5 = Agent
# Input WebMap json
Web_Map_as_JSON = arcpy.GetParameterAsText(0)
# The template location in the server data store
templateMxd = arcpy.GetParameterAsText(2)
title = arcpy.GetParameterAsText(3)
subtitle = arcpy.GetParameterAsText(4)
agent = arcpy.GetParameterAsText(5)
# Convert the WebMap to a map document
result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)
mxd = result.mapDocument
# Reference the data frame that contains the webmap
# Note: ConvertWebMapToMapDocument renames the active dataframe in the template_mxd to "Webmap"
df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0]
for elem in arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT"):
if elem.name == "Title":
elem.text = title
elif elem.name == "Subtitle":
elem.text = subtitle
elif elem.name == "Agent":
elem.text = agent
# Use the uuid module to generate a GUID as part of the output name
# This will ensure a unique output name
output = 'WebMap_{}.pdf'.format(str(uuid.uuid1()))
Output_File = os.path.join(arcpy.env.scratchFolder, output)
# Export the WebMap
arcpy.mapping.ExportToPDF(mxd, Output_File)
# Set the output parameter to be the output file of the server job
arcpy.SetParameterAsText(1, Output_File)
# Clean up - delete the map document reference
filePath = mxd.filePath
del mxd, result
os.remove(filePath)
javascript arcgis-javascript-api symbology pdf geoprocessing-service
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I am using the ESRI js API, and using a python GP service to run a print task to PDF with custom layouts. This works great, except when i have any map service enabled in the map. The layer in the resulting PDF displays jumbo sized points, and I cannot figure out why or what to change. Thanks in advance for any advice!
printTask = new esri.tasks.PrintTask(printUrl, { //new instance of print job
async: false //our service is set to syncronous
});
params = new esri.tasks.PrintParameters(); //placeholder for our parameters to put in the script
params.map = map; //reference to the active map object
function print(){ //action to run when submit is clicked
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "none");
document.getElementById("printStatus").innerHTML = " Converting to PDF <img src='loader.gif'>";
var title = dijit.byId("title").get("value") //parameter[2]
var subtitle = dijit.byId("subtitle").get("value") //parameter[3]
var agent = dijit.byId("agent").get("value") //parameter[4]
var legendLayer = new esri.tasks.LegendLayer();
params.template = {
layout: mxdTemplate,
format: 'PDF',
preserveScale: false,
layoutOptions: {
legendLayers: []
}
};
params.outSpatialReference = map.spatialReference
params.extraParameters = {
Title: title,
Subtitle: subtitle,
Agent: agent
}; //the custom parameters for the python script
printTask.execute(params, printComplete, printError); //run the task, completion triggers 'printComplete' function, any error triggers printError
}
function printComplete(result){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
console.log(result.url);
document.getElementById("printStatus").innerHTML = "<a href='" + result.url + "' target='_blank'><b>Download PDF<b></a>" //link to the PDF
}
function printError(error){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
document.getElementById("printStatus").innerHTML = "An unexpected Error has occured <br>( " + error + " )<br> try saving again" //error warning popup
}
Python GP service
import arcpy
import os
import uuid
# Param 0 = INPUT JSON STRING
# Param 1 = OUTPUT FILE
# Param 2 = Layout Template
# Param 3 = Title
# Param 4 = Subtitle
# Param 5 = Agent
# Input WebMap json
Web_Map_as_JSON = arcpy.GetParameterAsText(0)
# The template location in the server data store
templateMxd = arcpy.GetParameterAsText(2)
title = arcpy.GetParameterAsText(3)
subtitle = arcpy.GetParameterAsText(4)
agent = arcpy.GetParameterAsText(5)
# Convert the WebMap to a map document
result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)
mxd = result.mapDocument
# Reference the data frame that contains the webmap
# Note: ConvertWebMapToMapDocument renames the active dataframe in the template_mxd to "Webmap"
df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0]
for elem in arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT"):
if elem.name == "Title":
elem.text = title
elif elem.name == "Subtitle":
elem.text = subtitle
elif elem.name == "Agent":
elem.text = agent
# Use the uuid module to generate a GUID as part of the output name
# This will ensure a unique output name
output = 'WebMap_{}.pdf'.format(str(uuid.uuid1()))
Output_File = os.path.join(arcpy.env.scratchFolder, output)
# Export the WebMap
arcpy.mapping.ExportToPDF(mxd, Output_File)
# Set the output parameter to be the output file of the server job
arcpy.SetParameterAsText(1, Output_File)
# Clean up - delete the map document reference
filePath = mxd.filePath
del mxd, result
os.remove(filePath)
javascript arcgis-javascript-api symbology pdf geoprocessing-service
I am using the ESRI js API, and using a python GP service to run a print task to PDF with custom layouts. This works great, except when i have any map service enabled in the map. The layer in the resulting PDF displays jumbo sized points, and I cannot figure out why or what to change. Thanks in advance for any advice!
printTask = new esri.tasks.PrintTask(printUrl, { //new instance of print job
async: false //our service is set to syncronous
});
params = new esri.tasks.PrintParameters(); //placeholder for our parameters to put in the script
params.map = map; //reference to the active map object
function print(){ //action to run when submit is clicked
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "none");
document.getElementById("printStatus").innerHTML = " Converting to PDF <img src='loader.gif'>";
var title = dijit.byId("title").get("value") //parameter[2]
var subtitle = dijit.byId("subtitle").get("value") //parameter[3]
var agent = dijit.byId("agent").get("value") //parameter[4]
var legendLayer = new esri.tasks.LegendLayer();
params.template = {
layout: mxdTemplate,
format: 'PDF',
preserveScale: false,
layoutOptions: {
legendLayers: []
}
};
params.outSpatialReference = map.spatialReference
params.extraParameters = {
Title: title,
Subtitle: subtitle,
Agent: agent
}; //the custom parameters for the python script
printTask.execute(params, printComplete, printError); //run the task, completion triggers 'printComplete' function, any error triggers printError
}
function printComplete(result){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
console.log(result.url);
document.getElementById("printStatus").innerHTML = "<a href='" + result.url + "' target='_blank'><b>Download PDF<b></a>" //link to the PDF
}
function printError(error){
dojo.style(dijit.byId("statusDialog").closeButtonNode, "display", "block");
document.getElementById("printStatus").innerHTML = "An unexpected Error has occured <br>( " + error + " )<br> try saving again" //error warning popup
}
Python GP service
import arcpy
import os
import uuid
# Param 0 = INPUT JSON STRING
# Param 1 = OUTPUT FILE
# Param 2 = Layout Template
# Param 3 = Title
# Param 4 = Subtitle
# Param 5 = Agent
# Input WebMap json
Web_Map_as_JSON = arcpy.GetParameterAsText(0)
# The template location in the server data store
templateMxd = arcpy.GetParameterAsText(2)
title = arcpy.GetParameterAsText(3)
subtitle = arcpy.GetParameterAsText(4)
agent = arcpy.GetParameterAsText(5)
# Convert the WebMap to a map document
result = arcpy.mapping.ConvertWebMapToMapDocument(Web_Map_as_JSON, templateMxd)
mxd = result.mapDocument
# Reference the data frame that contains the webmap
# Note: ConvertWebMapToMapDocument renames the active dataframe in the template_mxd to "Webmap"
df = arcpy.mapping.ListDataFrames(mxd, 'Webmap')[0]
for elem in arcpy.mapping.ListLayoutElements(mxd,"TEXT_ELEMENT"):
if elem.name == "Title":
elem.text = title
elif elem.name == "Subtitle":
elem.text = subtitle
elif elem.name == "Agent":
elem.text = agent
# Use the uuid module to generate a GUID as part of the output name
# This will ensure a unique output name
output = 'WebMap_{}.pdf'.format(str(uuid.uuid1()))
Output_File = os.path.join(arcpy.env.scratchFolder, output)
# Export the WebMap
arcpy.mapping.ExportToPDF(mxd, Output_File)
# Set the output parameter to be the output file of the server job
arcpy.SetParameterAsText(1, Output_File)
# Clean up - delete the map document reference
filePath = mxd.filePath
del mxd, result
os.remove(filePath)
javascript arcgis-javascript-api symbology pdf geoprocessing-service
javascript arcgis-javascript-api symbology pdf geoprocessing-service
edited Nov 3 '14 at 20:05
PolyGeo♦
54.1k1782247
54.1k1782247
asked Nov 3 '14 at 19:00
MetalMessiahMetalMessiah
61
61
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 7 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Maybe the reason is that a reference scale is set for theses map service.
So you can define a corresponding reference scale in environment setting.
For example: arcpy.env.referenceScale = "25000"
Please check the document Reference Scale.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f120793%2fesri-javascript-print-task-gp-service-symbology-issue%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Maybe the reason is that a reference scale is set for theses map service.
So you can define a corresponding reference scale in environment setting.
For example: arcpy.env.referenceScale = "25000"
Please check the document Reference Scale.
add a comment |
Maybe the reason is that a reference scale is set for theses map service.
So you can define a corresponding reference scale in environment setting.
For example: arcpy.env.referenceScale = "25000"
Please check the document Reference Scale.
add a comment |
Maybe the reason is that a reference scale is set for theses map service.
So you can define a corresponding reference scale in environment setting.
For example: arcpy.env.referenceScale = "25000"
Please check the document Reference Scale.
Maybe the reason is that a reference scale is set for theses map service.
So you can define a corresponding reference scale in environment setting.
For example: arcpy.env.referenceScale = "25000"
Please check the document Reference Scale.
edited Oct 19 '18 at 0:52
answered Oct 18 '18 at 23:19
PhoebePhoebe
112
112
add a comment |
add a comment |
Thanks for contributing an answer to Geographic Information Systems Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f120793%2fesri-javascript-print-task-gp-service-symbology-issue%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown