printing custom basemap

3241
11
02-26-2013 01:25 AM
RaivoAlla
New Contributor II
Hello!

We have implemented esri.layers.TiledMapServiceLayer basemaps in our Javascript code (external TMS tiles) and now we are having a problem including such basemap into outprint.
Basemaps are added via map.addLayer interface and default printing service is declared this way:
[INDENT][INDENT]   var printer = new esri.dijit.Print({
     map: map,
     url: "http://atlas:6080/arcgis/rest/services/Raivotest/ExportWebMap/GPServer/Export%20Web%20Map"
   }, dojo.byId("b_print"));
   printer.startup();[/INDENT][/INDENT]

But, this output file contains only ArcGISDynamicMapServiceLayer layers . How I can include TiledMapServiceLayer?

It is a major problem here as those basemaps are for us very important.
Is ArcGIS a system or closed system?

Thank you,
Raivo Alla
Estonian Land Board
0 Kudos
11 Replies
HemingZhu
Occasional Contributor III
Hello!

We have implemented esri.layers.TiledMapServiceLayer basemaps in our Javascript code (external TMS tiles) and now we are having a problem including such basemap into outprint.
Basemaps are added via map.addLayer interface and default printing service is declared this way:
[INDENT][INDENT]   var printer = new esri.dijit.Print({
     map: map,
     url: "http://atlas:6080/arcgis/rest/services/Raivotest/ExportWebMap/GPServer/Export%20Web%20Map"
   }, dojo.byId("b_print"));
   printer.startup();[/INDENT][/INDENT]

But, this output file contains only ArcGISDynamicMapServiceLayer layers . How I can include TiledMapServiceLayer?

It is a major problem here as those basemaps are for us very important.
Is ArcGIS a system or closed system?

Thank you,
Raivo Alla
Estonian Land Board


I would try to initialize the print widget after the tiledMapserviceLayer is loaded up and see what happen...
0 Kudos
JianHuang
Occasional Contributor III
Please try webTiledLayer, instead of a custom TiledLayer.
0 Kudos
RaivoAlla
New Contributor II
Thanks Heming, but printing tool is already initialized after my tiled layer gets loaded...

Please try webTiledLayer, instead of a custom TiledLayer.

Does it support different coordinate systems (I could'nt find a way to define that)? We have all those tile services in our national CRS (EPSG:3301). 

Here (http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/layers_web_tiled) it's written that "The WebTileLayer works with tile sets that are in Web Mercator"... In that case it's a sad sad story for us, cause we have spent quite some time trying to make some sense of ArcGIS Javascript API... and now it follows that it would been better to use Leaflet after all. And Image Extension for ArcGIS Server is too expensive just for producing tile services thats already done outside ArcGIS "system" box.  


Thank you both for replying,
Raivo
0 Kudos
RaivoAlla
New Contributor II
I was successful with redefining TiledMapServiceLayer to WebTileLayer, but outcome is the same.
This layer wont show up on the outprint.
It is a pain... like being shot by dum-dum bullet.

Raivo
Estonian Land Board
0 Kudos
MarcusBush
New Contributor
I'm working on a project where I had a similar issue.  Print widget really just wasn't doing it for me.

We did two things to fix.

1. Made sure that we changed the URL configuration on ArcGIS server to read from the public website URL rather than the machine name, since the print service was on the same server as the layers we were trying to display.

2. Went with PrintTask rather than the widget, i.e.:

dojo.require("esri.tasks.PrintTask");

printBaseMap = function () {
    var printTask, params;
    printTask = new esri.tasks.PrintTask("http://yourserver.com/arcgis/rest/services/LetterPortrait/GPServer/Export%20Web%20Map");
    var ptemplate = new esri.tasks.PrintTemplate();
    ptemplate.layout = "Letter ANSI A Landscape";
    ptemplate.format = "PNG32";

    ptemplate.layoutOptions = {
        "authorText": "your author text",
        "copyrightText": "© " + (new Date).getFullYear(),
        "legendLayers": [],
        "titleText": "your title text",
        "scalebarUnit": "Miles"
    };

    // use the extent of the webmap in the output image
    ptemplate.preserveScale = false;
    ptemplate.showAttribution = false;
    params = new esri.tasks.PrintParameters();
    params.map = yourMap;
    params.template = ptemplate;
    printTask.execute(params, printComplete, printError);
}

printComplete = function (result) {
    window.open(result.url + "?k=" + new Date().getTime());
}

printError = function (error) {
    alert(error);
}
0 Kudos
JianHuang
Occasional Contributor III
Please check the print request in your browser's debug tool. I believe the request includes the custom TiledMapServiceLayer or WebTiledLayer. Then, it's the print service that doesn't work with your tiled map service.
Please post the print request here. I will try to diagnose it.
Thanks.

I was successful with redefining TiledMapServiceLayer to WebTileLayer, but outcome is the same.
This layer wont show up on the outprint.
It is a pain... like being shot by dum-dum bullet.

Raivo
Estonian Land Board
0 Kudos
RaivoAlla
New Contributor II
Please check the print request in your browser's debug tool. I believe the request includes the custom TiledMapServiceLayer or WebTiledLayer. Then, it's the print service that doesn't work with your tiled map service.
Please post the print request here. I will try to diagnose it.
Thanks.


Thanks Jian and Marcus!
Marcus, I'll try your approach too if PrintingTools fails.

Thats right, print request looks now different with WebTiledLayer:
http://atlas:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute?f=json&Web_Map_as_JSON=%7B%22mapOptions%22%3A%7B%22showAttribution%22%3Atrue%2C%22extent%22%3A%7B%22xmin%22%3A541255.859375%2C%22ymin%22%3A6587610.546350479%2C%22xmax%22%3A544869.140625%2C%22ymax%22%3A6589872.265100479%2C%22spatialReference%22%3A%7B%22wkid%22%3A3301%7D%7D%2C%22spatialReference%22%3A%7B%22wkid%22%3A3301%7D%2C%22scale%22%3A14763.75%7D%2C%22operationalLayers%22%3A%5B%7B%22id%22%3A%22kaart%22%2C%22title%22%3A%22kaart%22%2C%22opacity%22%3A1%2C%22minScale%22%3A1889760%2C%22maxScale%22%3A1845.46875%2C%22url%22%3A%22http%3A%2F%2Ftiles.maaamet.ee%2Ftm%2Fs%2F1.0.0%2Fkaart%2F%22%7D%2C%7B%22id%22%3A%22layer0%22%2C%22title%22%3A%22layer0%22%2C%22opacity%22%3A1%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22url%22%3A%22http%3A%2F%2Fatlas%3A6080%2Farcgis%2Frest%2Fservices%2FRaivotest%2Fraamatukogud%2FMapServer%22%2C%22visibleLayers%22%3Anull%2C%22layers%22%3A%5B%5D%7D%5D%2C%22exportOptions%22%3A%7B%22outputSize%22%3A%5B800%2C1100%5D%2C%22dpi%22%3A96%7D%7D&Format=PNG32&Layout_Template=MAP_ONLY

...There is indeed http://tiles.maaamet.ee/kaart... included as operationallayer(shouldn't it be as a basemap?), but output still lacks the layer.
Print request with TiledMapServiceLayer:
http://atlas:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute?f=json&Web_Map_as_JSON=%7B%22mapOptions%22%3A%7B%22showAttribution%22%3Atrue%2C%22extent%22%3A%7B%22xmin%22%3A538179.6875%2C%22ymin%22%3A6582123.436927795%2C%22xmax%22%3A552632.8125%2C%22ymax%22%3A6591170.311927795%2C%22spatialReference%22%3A%7B%22wkid%22%3A3301%7D%7D%2C%22spatialReference%22%3A%7B%22wkid%22%3A3301%7D%2C%22scale%22%3A59055%7D%2C%22operationalLayers%22%3A%5B%7B%22id%22%3A%22layer0%22%2C%22title%22%3A%22layer0%22%2C%22opacity%22%3A1%2C%22minScale%22%3A1889760%2C%22maxScale%22%3A1845.46875%2C%22url%22%3Anull%7D%2C%7B%22id%22%3A%22layer1%22%2C%22title%22%3A%22layer1%22%2C%22opacity%22%3A1%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22url%22%3A%22http%3A%2F%2Fatlas%3A6080%2Farcgis%2Frest%2Fservices%2FRaivotest%2Fmaaamet_katastriyksused%2FMapServer%22%2C%22visibleLayers%22%3Anull%2C%22layers%22%3A%5B%5D%7D%2C%7B%22id%22%3A%22layer2%22%2C%22title%22%3A%22layer2%22%2C%22opacity%22%3A1%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22url%22%3A%22http%3A%2F%2Fatlas%3A6080%2Farcgis%2Frest%2Fservices%2FRaivotest%2Fraamatukogud%2FMapServer%22%2C%22visibleLayers%22%3Anull%2C%22layers%22%3A%5B%5D%7D%2C%7B%22id%22%3A%22map_graphics%22%2C%22minScale%22%3A0%2C%22maxScale%22%3A0%2C%22featureCollection%22%3A%7B%22layers%22%3A%5B%5D%7D%7D%5D%2C%22exportOptions%22%3A%7B%22outputSize%22%3A%5B800%2C1100%5D%2C%22dpi%22%3A96%7D%7D&Format=PNG32&Layout_Template=MAP_ONLY

... here there's no tiled layer.

I have no idea how I can configure printing service to fix it. It is already in synchronous mode.


I really appreciate your feedback,
Raivo
0 Kudos
JianHuang
Occasional Contributor III
OK. This is a print service limit. It will support webTiledLayer in the future.
0 Kudos
deleted-user-Jie3eyjOl9XM
Occasional Contributor

I've got this problem, too. Any updates?

I can see my WebTiledLayer layer in the json. But, it doesn't include the LOD's, which could be a problem for the Print Server, because it wouldn't know how to get the tiles. So, it seems there would be a problem with the JavaScript and the Service.

0 Kudos