POST
|
in order to check the layer before printing I found this URL it has the answer: How to customize the ArcGIS print legend text using javascript - Geographic Information Systems Stack Exchange
... View more
10-12-2016
02:47 AM
|
1
|
0
|
368
|
POST
|
I needed to check the layer which the printtemplate receives so as to see if I am sending the right Layer. However there is a problem with printing when I am rendering a field with ClassBreaksRenderer the legend renders perfectly with print legend , however when I am rendering I am rendering another field the sample attached
... View more
10-11-2016
07:16 AM
|
0
|
0
|
368
|
POST
|
I am using Print task but not single function which runs on the click attached is the code : function printMap() { console.log('Global Render info') console.log(global_renderer); layer.setRenderer(global_renderer); layer.redraw(); //createLegend(rendering.featureMap.fields[0]); var legendLayer = new LegendLayer();// Get the legend Layers legendLayer.layerId = layer.id; console.log('legend Layer for Print'); console.log(layer); var printMap = new esri.tasks.PrintTask("http://statscenprod:6080/arcgis/rest/services/ExportWebMap9/GPServer/Export%20Web%20Map"); var params = new esri.tasks.PrintParameters(); var template = new esri.tasks.PrintTemplate(); var txtmetadata = document.getElementById("metadata").innerHTML; var len = 35; var curr = len; var prev = 0; alert(txtmetadata); output = []; var textmetaadat; if (txtmetadata.length > 35) { while (txtmetadata[curr]) { if ( txtmetadata[curr++] == ' ') { output.push(txtmetadata.substring(prev, curr).trim()); prev = curr; curr += len; } } output.push(txtmetadata.substr(prev).trim()); var joinedtxt = output.join('\n') alert(joinedtxt); textmetaadat = "Metadata : " + "\n" + joinedtxt; } else { textmetaadat = "Metadata : " + "\n" + document.getElementById("metadata").innerHTML; } template.exportOptions = ; template.format = "pdf"; template.layout = "Letter ANSI A Landscape6"; console.log(legendLayer); template.preserveScale = true; template.showAttribution = false; template.layoutOptions = ] }; params.map = map; params.template = template; printMap.execute(params, printResult).then(function(resolvedVal){ console.log(resolvedVal); // Logs the value the promise resolves to }); }; function printResult(result) { var time = new Date(); console.log(time.getTime()) window.open(result.url += "?Atlastimets=" + time.getTime()); console.log('check the layer after printing') console.log(layer); }; $('#btn').click(function () { printMap(); }); Regards Thabo Gilbert Mojahi Cell : 0713208732 Fax : 086 601 8766 Tel(office) : 012 310 6397 If people do not believe that mathematics is simple, it is only because they do not realize how complicated life is. ~John Louis von Neumann >>> "Robert Scheitlin, GISP" <geonet@esri.com> 10/10/2016 16:38 >>> GeoNet ( https://community.esri.com/?et=watches.email.thread) Re: Printask printtemplate legend issuereply from Robert Scheitlin, GISP ( https://community.esri.com/people/rscheitlin?et=watches.email.thread) in ArcGIS API for JavaScript - View the full discussion ( https://community.esri.com/message/639938-re-printask-printtemplate-legend-issue?commentID=639938&et=watches.email.thread#comment-639938) Thabo, Are you using the Print Dijit or just some custom code that uses the PrintTask? Reply to this message by replying to this email, or go to the message on GeoNet ( https://community.esri.com/message/639938-re-printask-printtemplate-legend-issue?commentID=639938&et=watches.email.thread#comment-639938) Start a new discussion in ArcGIS API for JavaScript by email ( mailto:discussions-community-developers-web developers-arcgis api for javascript@mail.geonet.esri.com) or at GeoNet ( https://community.esri.com/choose-container.jspa?contentType=1&containerType=14&container=2128&et=watches.email.thread) Following Re: Printask printtemplate legend issue ( https://community.esri.com/message/639938-re-printask-printtemplate-legend-issue?commentID=639938&et=watches.email.thread#comment-639938) in these streams: Inbox This email was sent by GeoNet because you are a registered user. You may unsubscribe ( https://community.esri.com/unsubscribe.jspa?email=thabomoj%40statssa.gov.za&token=8cc2f7c722630dbf4d0b040099a8f18de596fb44255fed8a1746a394189b9352) instantly from GeoNet, or adjust email frequency in your email preferences ( https://community.esri.com/user-preferences!input.jspa)
... View more
10-10-2016
07:45 AM
|
0
|
0
|
368
|
POST
|
I need to ask , how to check the passed legend layer info( json) into the printtemplate before printing. Please geo programmers i need your assistance.
... View more
10-10-2016
12:49 AM
|
0
|
4
|
1197
|
POST
|
Printing issue using Arcgis Javascript api 3.17. I have created a custom print template. everything is working fine when creating a smart mapping classbreaks render . eg NB printing is working fine with this function , function createRenderer(field) {console.log("create renderer: " + field); //smart mapping functionality begins smartMapping.createClassedColorRenderer({ "layer": layer, "field": field, "basemap": "gray", //map.getBasemap(), "classificationMethod": "quantile" }).then(function (response) { layer.setRenderer(response.renderer); createLegend(field); //printMap() layer.redraw(); }); } the problem arise when using a geostats.js api to create class break render the the legend doesn't updated or show values. Any ideas what might be causing this issue. code for geostats.js function createClassBreaksRenderer(renderLayer, fieldValues, field) { var renderer = new ClassBreaksRenderer(null, field); //get class breaks var classBreaks = getClassBreaks(fieldValues); // this must be jenks //loop through class breaks until the second last one for (i = 0; i < classBreaks.length - 1 ; i++) { //add class breaks to renderer and set the color renderer.addBreak(classBreaks, classBreaks[i + 1], new SimpleFillSymbol().setColor(new Color(rendering.featureMap.color))); } setRenderer(renderLayer, renderer, field); //createLegend(field); } function getClassBreaks(fieldValues) { var numClasses = 5; //number of class breaks //make sure the number of class breaks is less than the number of field values if (fieldValues.length <= numClasses) { numClasses = fieldValues.length - 1; } //use geostats api var serie = new geostats(fieldValues); serie.setPrecision(0); serie.silent = true; //get Jenks class breaks var classBreaks = serie.getClassJenks(numClasses); return classBreaks; } //Print Function function printMap() { var StatslegendLayer = new esri.tasks.LegendLayer();// Get the legend Layers var legendLaye = [] StatslegendLayer.layerId = layer.id; legendLaye.push(StatslegendLayer); alert(layer.url); alert(layer.id); alert(layer.name); for (var j = 0, jl = map.layerIds.length; j < jl; j++) { var currentLayer = map.getLayer(map.layerIds ); alert("id: " + currentLayer.id); } var printMap = new esri.tasks.PrintTask("http://ourserver:6080/arcgis/rest/services/ExportWebMap9/GPServer/Export%20Web%20Map"); var params = new esri.tasks.PrintParameters(); var template = new esri.tasks.PrintTemplate(); var txtmetadata = document.getElementById("metadata").innerHTML; var len = 35; var curr = len; var prev = 0; alert(txtmetadata); output = []; var textmetaadat; if (txtmetadata.length > 35) { while (txtmetadata[curr]) { if ( txtmetadata[curr++] == ' ') { output.push(txtmetadata.substring(prev, curr).trim()); prev = curr; curr += len; } } output.push(txtmetadata.substr(prev).trim()); var joinedtxt = output.join('\n') alert(joinedtxt); textmetaadat = "Metadata : " + "\n" + joinedtxt; } else { textmetaadat = "Metadata : " + "\n" + document.getElementById("metadata").innerHTML; } template.exportOptions = { dpi: 96 }; template.format = "pdf"; template.layout = "Letter ANSI A Landscape6"; template.preserveScale = true; template.showAttribution = false; template.layoutOptions = { legendLayers: legendLaye, // empty array means no legend scalebarUnit: "km", customTextElements: [ { metadata: textmetaadat } ] }; params.map = map; params.template = template; printMap.execute(params, printResult); params.map = null params.template = null legendLayer.id = " "; };
... View more
10-04-2016
02:14 AM
|
0
|
0
|
1275
|
Title | Kudos | Posted |
---|---|---|
1 | 10-12-2016 02:47 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|