1

I am trying to print a map using a print service. I have followed the example on the ArcGIS site namely:

https://developers.arcgis.com/javascript/jssamples/widget_print_esri_request.html

However I can't get it to work using a local feature layer.

Can someone please give some advice?

This is what I have done so far:

    parser.parse();

    app.printUrl = "http://local_server/arcgis/rest/services/Layout/WSC_LAYOUT1/GPServer/Export%20Web%20Map";

    esri.config.defaults.io.corsEnabledServers.push("local_server");

    app.map = new Map("map");

    //Base map
    var basemap = new ArcGISDynamicMapServiceLayer("http://local_server/arcgis/rest/services/NAME/Basemap/MapServer/");
    basemap.setVisibleLayers([0, 1, 2, 3, 4, 5, 6, 7]);

     app.map.addLayer(basemap);

    // add graphics for feature
    var url = "http://local_server/arcgis/rest/services/NAME/NAME/FeatureServer/n";
    var pipeFeatureLayer = new FeatureLayer(url, {
      "mode": FeatureLayer.MODE_SNAPSHOT
    });
    app.map.addLayer(pipeFeatureLayer);
  • 1
    Welcome to GIS Stack Exchange. Can you please clarify "can't get it to work" - what have you tried, and what happens when you try it? What do you mean by "local feature layer" - do you have ArcGIS Server running on your local machine? Or are you running a web page on your local machine with ArcGIS Server somewhere on the web? – Stephen Lead Sep 26 '14 at 5:51
  • What I mean with can't get it to work is that when I am replacing the basemap with a url of a basemap on a local server the map is not showing. – fran_ferg Sep 26 '14 at 7:16
  • Usually as basemap is a tiled service. Perhaps try changing ArcGISDynamicMapServiceLayer to ArcGISTiledMapServiceLayer. However, that goes against the next line where your specifying layers on and off within that service. Is your service tiled? – Simon Sep 26 '14 at 7:35
  • I tried with the ArcGISTiledMapServiceLayer with the same results – fran_ferg Sep 26 '14 at 8:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.