Select to view content in your preferred language

import raster layers using ConvertWebMapToArcGISProject

279
0
11-21-2022 11:36 PM
masa
by
Emerging Contributor

I want to create an ArcGIS-Project using the ConvertWebMapToArcGISProject command. A JSON file is used as a input for this. The aim is to export a pdf (or an image) of the included layout file as a vector graphic and explicit not as a raster graphic. 

But since the JSON file only reads the direct service and not the layer itself, the layout can only be exported as a raster graphic. Therefore I change the structure of the JSON file to read the layer directly. Here is an example (only the interesting part of the JSON):

old:

{
  "layerType":"ArcGISMapServiceLayer",
  "layers":[
    {
      "id":3,
      "name":"test1",
      "layerDefinition":{
        "source":{
          "type":"mapLayer",
          "mapLayerId":3
        }
      }
    },
    {
      "id":209,
      "name":"test2",
      "layerDefinition":{
        "source":{
          "type":"mapLayer",
          "mapLayerId":209
        }
      }
    }
  ],
  "url":"test-url",
  "id":"18465d15e65-layer-26",
  "title":"Deutschland",
  "opacity":1,
  "minScale":0,
  "maxScale":0
}


new: 

{
  "visibility":true,
  "url":"test-url",
  "id":209,
  "title":"test2",
  "opacity":1,
  "minScale":0,
  "maxScale":0,
  "layerDefinition":{
    "source":{
      "type":"mapLayer",
      "mapLayerId":209
    }
  }
},
{
  "visibility":true,
  "url":"test-url",
  "id":3,
  "title":"test1",
  "opacity":1,
  "minScale":0,
  "maxScale":0,
  "layerDefinition":{
    "source":{
      "type":"mapLayer",
      "mapLayerId":3
    }
  }
}

 

This also works very well so far. Only not when raster layers are to be imported. Then an error message appears that the layer would not exist. But the URL to the layer is definitely correct. This problem only occurs with raster layers, all other layers are imported correctly (including definition queries, filters etc.).

The perfect solution would be if all layers would be imported directly, because the legend in the layout would then not show any unnecessary entries (only for layers and not for services only the visible objects are shown and all others are hidden).

Do you have any ideas how to solve the problem?

 

 

 

 

 

 

 

0 Kudos
0 Replies