print map with large custom features

1496
10
08-29-2016 02:09 AM
yanli
by
New Contributor II

I create  100 polygon features in map,then  i print the map with the features,But  I run the printTask , the server is collapse; I create 20 polygon the print the result is ok.  the  number for printTask is limit? 

I use the arcgis api for js 3.17!

function ShowByZhen(id) {
 var queryTask = new esri.tasks.QueryTask("http://192.168.20.1:6080/arcgis/rest/services/zhen/MapServer/0");
 var query = new esri.tasks.Query();
 query.returnGeometry = true;
 query.outFields = ["*"];
 query.where = "1=1";
 queryTask.execute(query, ShowByZhen_ShowResults);
 queryTask.on("error", queryTaskErrorHandler);

}

function ShowByZhen_ShowResults(results) {

// var symbol = new esri.symbol.SimpleFillSymbol().setColor(new esri.Color([205, 192, 197,0.5])).outline.setColor(new esri.Color([189, 0, 38, 0.5]));
 var symbol = new esri.symbol.SimpleFillSymbol().setColor(new esri.Color([205, 193, 197, 0.5]));
 var fss = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
 new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new esri.Color([205, 192, 197]), 2),
 new esri.Color([255,255,0,0.25]));
 alert(results.features.length);
 var resultCount = results.features.length;
 for(var i=0;i<resultCount;i++)
 {
 var mFeature = results.features;
 var mFeatureAttribute = results.features.attributes;
 mFeatureAttribute["moneyfinish"] = 10000*i;
 
 if (i < 130) {
 mFeature.symbol = fss;
 map.graphics.add(mFeature);
 
 }
 }
}


function Print() {
 var printUrl="http://192.168.20.1:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"
 printTask = new esri.tasks.PrintTask(printUrl, { async: true });
 params = new esri.tasks.PrintParameters();
 params.map = map;


 //*****print
 var ptemplate = new esri.tasks.PrintTemplate();
 ptemplate.layout = "A3 Landscape";
 // ptemplate.layout = "MAP_ONLY";
 ptemplate.format = "jpg";
 ptemplate.layoutOptions = {
 legendlayers: [],
 scalebarUnit: "Meters",
 titleText: Titletxt
 }
 // use the extent of the webmap in the output PDF
 ptemplate.preserveScale = false;
 params.template = ptemplate;

// params.template = "A3 Landscape";
 printTask.execute(params, printComplete);


}
0 Kudos
10 Replies
thejuskambi
Occasional Contributor III

What do you mean by "server is collapse"? Do you get any error message? Did you check the server logs to determine what the issue is?

0 Kudos
yanli
by
New Contributor II

I get the error  when create more than 100 polygon 

""Error executing tool.: ERROR 000735: Web Map as JSON: Value is required The value is empty. The value is empty. ERROR 000735: Web Map as JSON: Value is required"

the  value  is missing

the  size of  "Web Map as JSON" is limited?

0 Kudos
FC_Basson
MVP Regular Contributor

If the Web Map JSON is too large (> 2000 characters) the request must be a POST request.  See the comments by Jian Huang‌ in this post: https://community.esri.com/thread/67868#post355575 

yanli
by
New Contributor II

1.   I find with ff   the  print  request default   is  "post"  method  ,so I need't to change the request?

2. when i  fire the request directly at the REST endpoint? get  the error

0 Kudos
FC_Basson
MVP Regular Contributor

No need to change the request type then.  Have you evaluated the JSON string?  You could Json Parser Online for the job.

0 Kudos
yanli
by
New Contributor II

I modify  the  example online Print | ArcGIS API for JavaScript 3.17     , I create tht 136 polygons of city boundary with local json data  on map , it  still print error!I put the code into  github GitHub - yanliasdf789/Test1: arcgis for js print error with larte features

0 Kudos
yanli
by
New Contributor II

the position of polygons  are  in China

0 Kudos
PanagiotisPapadopoulos
Esri Regular Contributor

you are trying to query a set of polygons --> add the result as graphics on map and then --> print ?????

if this is the steps and the number of polygons causing problem try to set the where clause from the query to the Definition Expression and then try to print.

0 Kudos
yanli
by
New Contributor II

yes, my  steps like this "query a set of polygons --> add the result as graphics on map and then --> print", because the query polygon don't have the  attibute fields value,i store the attibute value in other  sql server database. so  i can't query to the Definition Expression and then try to print According to the attibute fields value.

0 Kudos