POST
|
Hi, I'm trying to use the print widget but it fails with the error message failed to create layer from service at http....../..../.../....etc. doesn;'t matter the page size or format, it always fails. I'm using webAppBuilder 2.11 on our dev server and using locallayer to bring in layers from ArcGIS Server 10.6 via a published mxd. I had the same problem when I was trying to develop a mapping service using the javascript api. printing would not work there either (It fails silently) Assuming the print service is an out of the box solution, what else can I look at? I've looked at the setting on ArcGIS server, I've also tried logging onto our server loading up the map and printing directly from there with no luck. I've really hit a brick wall here and everything I've tried does not work. Does anyone have any ideas on where I could try looking next? Thanks.
... View more
03-26-2019
09:19 AM
|
1
|
87
|
18646
|
POST
|
UPDATE: I've just downloaded version 2.8 and it's working fine. I can't print, but that seems to be a separate issue.
... View more
03-11-2019
01:07 PM
|
0
|
0
|
990
|
POST
|
I created a stripped down html document with just two scripts in it, the main map viewer and the print scripts, and replaced my mapservice with this example one: layer = new ArcGISDynamicMapServiceLayer = ("https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer" ....... I also replaced it here: var layerUrl = "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer"; and the printout works! So now I have to figure out why my published mapservice causes the print function to fail.
... View more
03-08-2019
01:46 PM
|
0
|
0
|
258
|
POST
|
I've just come across LocalLayer - It's a great idea and I'm trying it out with WAB 2.11 but I'm finding some problems: 1) None of the other widgets I add work - they become disabled and nothing happens when you click on them. For example, I added the basemap widget but when you click on it, nothing happens. If I remove the LocalLayer widget layers, they suddenly work again. 2) The layers aren't showing up in the legend view widget (The only way to get this to 'work' is to make it expandable by default, by work I mean expand it...but nothing is showing). 3) After I save, and go back into the webapp to work on it, it doesn't fully load...I'm left with the three undulating bars forever...My only fix is to delete the map and start all over again. I'm pulling in layers from a published mapservice from ArcGIS Server 10.6. The version of the LocalLayer widget is 2.5, WAB version is 2.11 Does anybody have any ideas? Thanks!
... View more
03-08-2019
12:18 PM
|
0
|
0
|
990
|
POST
|
My browser console reports the following (When I click the print button): Error: "Unable to complete operation." load https://js.arcgis.com/3.27/:1038 _ioSetArgs https://js.arcgis.com/3.27/:88 c https://js.arcgis.com/3.27/:104 e https://js.arcgis.com/3.27/:104 callback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 callback https://js.arcgis.com/3.27/:106 xhr https://js.arcgis.com/3.27/:93 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 a https://js.arcgis.com/3.27/:109 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 a https://js.arcgis.com/3.27/:109 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 a https://js.arcgis.com/3.27/:109 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 d https://js.arcgis.com/3.27/:140 f https://js.arcgis.com/3.27/:144 Print.js:9:144 _printError https://js.arcgis.com/3.27/esri/dijit/Print.js:9 hitch https://js.arcgis.com/3.27/:64 _errorHandler https://js.arcgis.com/3.27/:2304 hitch https://js.arcgis.com/3.27/:64 _pendingDfd https://js.arcgis.com/3.27/esri/tasks/PrintTask.js:6 hitch https://js.arcgis.com/3.27/:64 c https://js.arcgis.com/3.27/:104 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 hitch https://js.arcgis.com/3.27/:64 c https://js.arcgis.com/3.27/:104 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 _errorHandler https://js.arcgis.com/3.27/:2304 hitch https://js.arcgis.com/3.27/:64 f https://js.arcgis.com/3.27/esri/tasks/PrintTask.js:13 _errorHandler https://js.arcgis.com/3.27/:2304 hitch https://js.arcgis.com/3.27/:64 error https://js.arcgis.com/3.27/esri/tasks/Geoprocessor.js:14 I https://js.arcgis.com/3.27/:1055 c https://js.arcgis.com/3.27/:104 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 f https://js.arcgis.com/3.27/:1052 c https://js.arcgis.com/3.27/:104 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 errback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 callback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 callback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 callback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 callback https://js.arcgis.com/3.27/:106 c https://js.arcgis.com/3.27/:105 e https://js.arcgis.com/3.27/:104 callback https://js.arcgis.com/3.27/:106 xhr https://js.arcgis.com/3.27/:93 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 a https://js.arcgis.com/3.27/:109 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 a https://js.arcgis.com/3.27/:109 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 a https://js.arcgis.com/3.27/:109 l https://js.arcgis.com/3.27/:108 k https://js.arcgis.com/3.27/:108 resolve https://js.arcgis.com/3.27/:110 d https://js.arcgis.com/3.27/:140 f https://js.arcgis.com/3.27/:144
... View more
03-07-2019
06:42 AM
|
0
|
1
|
258
|
POST
|
I plan on moving them to separate .js files soon. Right now I find that makes it easy to read and see where one script starts and another finishes, and also I'm not fishing in and out of separate .js files all the time. Makes sense. However, this particular problem has been keeping things on hold.
... View more
03-06-2019
02:48 PM
|
0
|
3
|
445
|
POST
|
There is no console log that I can see (I wouldn't know where that would be). I'm writing it in notepad++ and it's not a js file, the scripts all in a single html document (for now).
... View more
03-06-2019
02:19 PM
|
0
|
5
|
445
|
POST
|
Oh yes I see the changes! Sorry, I thought you'd just posted my code back as a quote. It's been a long day. Doh.... Well what you've posted still doesn't work. it says printing when I click on the print button, but it seems to fail silently, with the button going back to Print and no output - similar to what I've been trying. I've even created a new html document with just these two scripts, just in case something was interfering, but nope it still won't print. I've been scouring through the code line by line and I just can't see what's going wrong here
... View more
03-06-2019
01:56 PM
|
0
|
7
|
445
|
POST
|
Nevermind. I think I've found some examples. I'll see if I can get this to work.
... View more
03-06-2019
07:54 AM
|
0
|
9
|
445
|
POST
|
Are there any examples of how this is done? Seeing some code makes a lot more sense to me than describing what needs to happen - as I said earlier, I'm not a programmer. I have tried calling the map object to the print script but it hasn't worked.
... View more
03-06-2019
07:40 AM
|
0
|
10
|
445
|
POST
|
Hi Robert, yep, I agree, this should be simple...Anyway, This is the code to dynamically load the map layers by looping through the map service: <script src="https://js.arcgis.com/3.27/"></script> <script> //Dynamic layer script. Loops through a map service for all layers and automatically lists them in a map. var layer, map, mapLegend, visible = []; require([ "esri/map", "esri/layers/ArcGISDynamicMapServiceLayer", "dojo/dom", "dojo/on", "dojo/query", "dojo/_base/array", "dojo/domReady!" ], function( Map, ArcGISDynamicMapServiceLayer, dom, on, query, arrayUtils ) { map = new Map( "map", {basemap: "satellite", center: [-102, 54.75], slider: true, nav: false, zoom: 6}); //Point the url below to the published mapservice you want to use layer = new ArcGISDynamicMapServiceLayer("https://xxxxxxx/arcgis/rest/services/Test/DMAF_Application_V3/MapServer",{ "showAttribution": true, "opacity": 0.7, mode: ArcGISDynamicMapServiceLayer.MODE_ONDEMAND, outFields: ["*"], }); layer.on("load", buildLayerList); map.addLayer(layer); function buildLayerList() { var items = arrayUtils.map(layer.layerInfos, function(info, index) { if (info.defaultVisibility) { visible.push(info.id); } return "<input type='checkbox' class='list_item'" + (info.defaultVisibility ? "checked=checked" : "") + "' id='" + info.id + "'' /><label for='" + info.id + "'>" + info.name + "</label>"; }); var ll = dom.byId("layer_list"); ll.innerHTML = items.join(' '); layer.setVisibleLayers(visible); on(ll, "click", updateLayerVisibility); } function updateLayerVisibility() { var inputs = query(".list_item"); var input; visible = []; arrayUtils.forEach(inputs, function(input) { if (input.checked) { visible.push(input.id); } }); //if there aren't any layers visible set the array to be -1 if (visible.length === 0) { visible.push(-1); } layer.setVisibleLayers(visible); } }); </script> And this is the print code: script src="https://js.arcgis.com/3.27/"></script> <script> //Print a map script var Printapp = {}; require([ "esri/map", "esri/layers/FeatureLayer", "esri/dijit/Print", "esri/tasks/PrintTemplate", "esri/request", "esri/config", "dojo/_base/array", "dojo/dom", "dojo/parser", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!" ], function( Map, FeatureLayer, Print, PrintTemplate, esriRequest, esriConfig, arrayUtils, dom, parser ) { parser.parse(); Printapp.printUrl = "https://xxxxxxxxxxxx/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task"; esriConfig.defaults.io.proxyUrl = "/proxy/"; Printapp.map = new Map("map", { basemap: "topo", center: [-102, 54.75], slider: true, nav: false, zoom: 6}); // add graphics for layers var layerUrl = "https://xxxxxxxxxxx/arcgis/rest/services/Test/DMAF_Application_V3/MapServer"; var printFeatureLayer = new FeatureLayer(layerUrl, { "mode": FeatureLayer.MODE_SNAPSHOT }); Printapp.map.addLayer(printFeatureLayer); // get print templates from the export web map task var printInfo = esriRequest({ "url": Printapp.printUrl, "content": { "f": "json" } }); printInfo.then(handlePrintInfo, handleError); function handlePrintInfo(resp) { var layoutTemplate, templateNames, mapOnlyIndex, templates; layoutTemplate = arrayUtils.filter(resp.parameters, function(param, idx) { return param.name === "Layout_Template"; }); if ( layoutTemplate.length === 0 ) { console.log("print service parameters name for templates must be \"Layout_Template\""); return; } templateNames = layoutTemplate[0].choiceList; // remove the MAP_ONLY template then add it to the end of the list of templates mapOnlyIndex = arrayUtils.indexOf(templateNames, "MAP_ONLY"); if ( mapOnlyIndex > -1 ) { var mapOnly = templateNames.splice(mapOnlyIndex, mapOnlyIndex + 1)[0]; templateNames.push(mapOnly); } // create a print template for each choice templates = arrayUtils.map(templateNames, function(ch) { var plate = new PrintTemplate(); plate.layout = plate.label = ch; plate.format = "PDF"; plate.layoutOptions = { "authorText": "Made by: xxxxxxxxx", "copyrightText": "<copyright info here>", "legendLayers": [], "titleText": "Title", "scalebarUnit": "Miles" }; return plate; }); // create the print dijit Printapp.printer = new Print({ "map": Printapp.map, "templates": templates, url: Printapp.printUrl }, dom.byId("print_button")); Printapp.printer.startup(); } function handleError(err) { console.log("Something broke: ", err); } }); </script> In the page, the print script is directly under the dynamic map script code, which runs first. The trouble is, in this section in the print script: Printapp.map = new Map("map", { basemap: "topo", center: [-102, 54.75], slider: false, nav: false, zoom: 6}); it is insisting I have a new map. If I change it or do anything to this the code doesn't work. I have been trying many things, too many to go into details here, but usually the print button disappears or when I click it, nothing happens. Sometimes the generate legend script stops working too. I just want this print code to printout what is showing in the current map view. I have a resizable div section at the bottom of the mapping screen which I'm going to use in future for attribute tables, and when I drag resize it up and down, I can see the topo basemap drawing underneath, which I don't want. Thanks!
... View more
03-06-2019
07:13 AM
|
0
|
0
|
445
|
POST
|
Well this has me stumped. I have no idea how to get this to work. Tried everything I could think of. I guess PrintScreen will have to do.
... View more
03-05-2019
12:23 PM
|
0
|
2
|
658
|
POST
|
Hi Biraja, that approach doesn't work. Programmatically, I need this print script to reference the current map view that is provided by another script and I don't know how to do this with js. An example would help me out a lot. The example you've provided is just the print script in isolation which I've already gone through.
... View more
03-04-2019
11:19 AM
|
0
|
0
|
658
|
POST
|
Yes, it's in a different script, one that loops through the mapserver and loads all the layers - my question is how exactly do I get my print script to reference this looping script? I don't want it loading a new map underneath so I assumed if I commented it out it would automatically reference the looping script, but that hasn't worked. I have about 8,9 pther scripts and I need them to all play nicely with each other without breaking anything.
... View more
03-01-2019
01:45 PM
|
0
|
1
|
658
|
POST
|
So, instead of Printapp.map = new esri.Map ("map", it should be Printapp.map = new esri.Map ("https://path/to/mapserver", I'm not a programmer so please bear with me
... View more
03-01-2019
01:25 PM
|
0
|
1
|
658
|
Title | Kudos | Posted |
---|---|---|
1 | 03-26-2019 09:19 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|