DOC
|
Ok, I think I found out why it did not work for me: My Map uses Web Mercator. There is a function that calls the geometry service to determine the parameters to project the layout correctly. However this function was only called on startup. So it only worked for the default layout. If you copy the below section into the function _onLayoutChange all the other layouts work correct, too: if (this.showLayout) { this.mapUnitsToMeters.x = this.mapUnitsToMeters.y = scaleUtils.getUnitValueForSR(this.map.spatialReference); if (!this.mapUnitsToMeters.x) { // We cannot determine the map units, so don't show the layout. this.showLayout = false; } else if (this.mapUnitsToMeters.x > 10000 || this.map.spatialReference.isWebMercator()) { // If the spatial reference is geographic or Web Mercator, call the geometry service to get the parameters to project the layout onto the map. // This is an approximation, but adequate for small geographic areas (e.g. Hamilton County, IN - 400 Square miles) // TODO: Check the map area to see if an approximation makes sense var e = this.map.extent; // TODO: change this to get the initial extent??? var lineN = new Polyline(this.map.spatialReference); lineN.addPath([[e.xmin, e.ymax], [e.xmax, e.ymax]]); var lineS = new Polyline(this.map.spatialReference); lineS.addPath([[e.xmin, e.ymin], [e.xmax, e.ymin]]); var lineE = new Polyline(this.map.spatialReference); lineE.addPath([[e.xmax, e.ymax], [e.xmax, e.ymin]]); var lineW = new Polyline(this.map.spatialReference); lineW.addPath([[e.xmin, e.ymax], [e.xmin, e.ymin]]); var eDims = { x: e.getWidth(), y: e.getHeight() }; var lp = new LengthsParameters(); lp.polylines = [lineN, lineS, lineE, lineW]; lp.lengthUnit = esri.tasks.GeometryService.UNIT_METER; lp.geodesic = true; esriConfig.defaults.geometryService.lengths(lp, lang.hitch(this, function(result) { if (result.lengths.length === 4) { var southRatio = (result.lengths[0] / eDims.x); var northRatio = (result.lengths[1] / eDims.x); var westRatio = (result.lengths[2] / eDims.y); var eastRatio = (result.lengths[3] / eDims.y); // TODO: put in a check to fail if the ratios are too different? // var variation = [Math.abs(1 - (southRatio / northRatio)), Math.abs(1 - (westRatio / eastRatio))]; //console.log('variation:', variation); this.mapUnitsToMeters.x *= (southRatio + northRatio) / 2; this.mapUnitsToMeters.y *= (westRatio + eastRatio) / 2; console.log("this.mapUnitsToMeters_layoutChange", this.mapUnitsToMeters.x ,this.mapUnitsToMeters.y); } else { this.showLayout = false; console.error("Get Map Units to Layout Units Conversion Factors"); console.error("Calculating conversion factors failed. Print layouts will not be shown on the map."); } }), lang.hitch(this, function() { this.showLayout = false; console.error("Get Map Units to Layout Units Conversion Factors"); console.error("Calculating conversion factors failed. Print layouts will not be shown on the map."); }) ); } } Unfortunately I still have a problem with vector tile basemaps, that don`t display correctly. As with the above, they work finde in default layout, all the other somehow get cut off. I am not shure though if this is because of 10.5.1 or because of the app 😕
... View more
02-12-2019
12:16 AM
|
0
|
0
|
3646
|
DOC
|
Kipo Kipo : Have you ever found a solution for your Problem? I have the same at the moment - everything works fine with default layout but as soon as I switch to another layout the print extent is no longer correct.
... View more
01-18-2019
04:23 AM
|
0
|
0
|
3646
|
POST
|
So, after upgrading to 10.4.1 and still having the same problem I did some more testing and finally got it to work. The first of the following definitely was responsible, I am not sure about the second: When I added my Custom Text Elements I put in some long text to have a preview of how much space will be needed. This had some line breaks and special characters in it - after I removed the text and just put a single word in it, it worked I also had some dynamic text elements in my layout which had an Element Name - I removed these too So this was not really a problem with the service but with my layouts.
... View more
05-16-2017
12:37 AM
|
0
|
0
|
659
|
POST
|
Back from holiday: No unfortunately there are no warning messages to be found when I add the widget or when I use it. The fields just don't appear. I suspect the widget can't access the information from the Get Layout Templates Info but have no idea why.
... View more
01-05-2017
03:50 AM
|
0
|
2
|
659
|
POST
|
Thank you Robert, I had not found the first one. Unfortunately there seemed to be no sulution to the Problem... What I now did as a workaround is to modify the print widget so I can manually input the custom text elements. While this works in general it has the drawback that my co-workers can't use this new widget in the built-in WAB and that I have to host the whole application on our Webserver only because of this - so any ideas concerning the original problem would be appreciated.
... View more
12-22-2016
10:54 AM
|
0
|
4
|
659
|
POST
|
Helen and Jarrett - did you ever find a soulution for this? I am having the same Problem here...
... View more
12-20-2016
11:31 PM
|
0
|
0
|
1706
|
POST
|
Hello everybody, I would like to include custom text elements in my layouts for ArcGIS Online WAB Print Widget. As our Server is on 10.3 and does not include the Get Layout Templates Info Task by default, I followed this blog: https://blogs.esri.com/esri/arcgis/2016/06/20/printing-popups-from-web-application/ and used the python script from Github https://github.com/arcpy/sample-gp-tools/tree/master/GetLayoutTemplatesInfo Both the export webmap and the Get Layout Templates Info task run and publish successfully fololwing the help http://server.arcgis.com/en/server/10.4/get-started/windows/tutorial-publishing-additional-services-for-printing.htm and the Get Layout Info shows my custom text elements (see attached). Nevertheless, when I include my ExportWebmap Task in ArcGIS Online I can print, but the Custom Text Elements are not shown in the advanced tab. There are no error messages and I have no idea where to start looking for a reason why this is not working. Any help would be greatly appreciated!
... View more
12-20-2016
12:32 AM
|
0
|
6
|
2729
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|