Select to view content in your preferred language

Error executing tool. Export Web Map Task : Web map has invalid JSON. Failed to execute (Export Web Map). Failed to execute (Export Web Map Task)

4056
1
Jump to solution
05-17-2023 10:27 PM
Labels (3)
VinayV
by
New Contributor

Getting error when posting json data in Web Map as Json field.

Unable to complete operation.
Error executing tool. Export Web Map Task : Web map has invalid JSON. Failed to execute (Export Web Map). Failed to execute (Export Web Map Task).

Please see json data - 

"mapOptions": {
"extent": {
"xmin": -12933906.537,
"ymin": 3993856.886,
"xmax": -12933371.998,
"ymax": 3994375.189,
"spatialReference": {
"wkid": 102100
}
},
"scale": 1234.5,
"rotation": -45,
"spatialReference": {
"wkid": 102100
},
"time": [
1199145600000,
1230768000000
],
"background": {
"color": [51, 227, 200, 255]
}
}

I did validate Json data and found no issues. This format is in sync with ExportWebMap specification—ArcGIS Server | Documentation for ArcGIS Enterprise

 

0 Kudos
1 Solution

Accepted Solutions
A_Wyn_Jones
Esri Contributor

I believe you need to add some layers to be printed as well as define some exportOptions. There's a good example of WebMapAsJson available in this article:

https://support.esri.com/en-us/knowledge-base/how-to-publish-a-custom-print-service-with-embedded-cr...

This is the Json:

 

{
   "mapOptions":{
      "showAttribution":true,
      "extent":{
         "xmin":-37570328.14272009,
         "ymin":-15552387.679177042,
         "xmax":37570328.14272009,
         "ymax":19552387.679177042,
         "spatialReference":{
            "wkt":"PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]"
         }
      },
      "spatialReference":{
         "wkt":"PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]"
      },
      "scale":147914381.897889
   },
   "operationalLayers":[
      {
         "id":"defaultBasemap",
         "title":"World Topographic Map",
         "opacity":1,
         "minScale":0,
         "maxScale":0,
         "url":"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
      }
   ],
   "exportOptions":{
      "outputSize":[
         670,
         500
      ],
      "dpi":96
   },
   "layoutOptions":{
      "titleText":"",
      "authorText":"",
      "copyrightText":"",
      "customTextElements":[
         {
            "Date":"12/9/2019, 9:17:04 AM"
         }
      ],
      "scaleBarOptions":{
         "metricUnit":"esriKilometers",
         "metricLabel":"km",
         "nonMetricUnit":"esriMiles",
         "nonMetricLabel":"mi"
      },
      "legendOptions":{
         "operationalLayers":[
            
         ]
      }
   }
}

  

"We've boosted the Anti-Mass Spectrometer to 105 percent. Bit of a gamble, but we need the extra resolution."

View solution in original post

1 Reply
A_Wyn_Jones
Esri Contributor

I believe you need to add some layers to be printed as well as define some exportOptions. There's a good example of WebMapAsJson available in this article:

https://support.esri.com/en-us/knowledge-base/how-to-publish-a-custom-print-service-with-embedded-cr...

This is the Json:

 

{
   "mapOptions":{
      "showAttribution":true,
      "extent":{
         "xmin":-37570328.14272009,
         "ymin":-15552387.679177042,
         "xmax":37570328.14272009,
         "ymax":19552387.679177042,
         "spatialReference":{
            "wkt":"PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]"
         }
      },
      "spatialReference":{
         "wkt":"PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0]]"
      },
      "scale":147914381.897889
   },
   "operationalLayers":[
      {
         "id":"defaultBasemap",
         "title":"World Topographic Map",
         "opacity":1,
         "minScale":0,
         "maxScale":0,
         "url":"https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
      }
   ],
   "exportOptions":{
      "outputSize":[
         670,
         500
      ],
      "dpi":96
   },
   "layoutOptions":{
      "titleText":"",
      "authorText":"",
      "copyrightText":"",
      "customTextElements":[
         {
            "Date":"12/9/2019, 9:17:04 AM"
         }
      ],
      "scaleBarOptions":{
         "metricUnit":"esriKilometers",
         "metricLabel":"km",
         "nonMetricUnit":"esriMiles",
         "nonMetricLabel":"mi"
      },
      "legendOptions":{
         "operationalLayers":[
            
         ]
      }
   }
}

  

"We've boosted the Anti-Mass Spectrometer to 105 percent. Bit of a gamble, but we need the extra resolution."