Get Layout Templates Info (Server)

Summary

Returns the content of layout templates in JSON format. Layout files (.pagx) located in a folder are used as layout templates.

Usage

  • This tool is intended to be published as a geoprocessing task in a printing service. It is also used by the preconfigured PrintingTools service.

  • The output of this tool is a string formatted as JSON. The string is a list of available .pagx files and the following information:

    • The size and units of the page layout
    • The size of a map frame
      • If there are multiple map frames on the layout, it returns information only for the map frame that is named WEBMAP_MAP_FRAME.
    • The availability of the following layout elements:
      • Legend element
      • Title text element
      • Copyright text element
      • Author text element
      • Custom text elements and their names and existing values
      • North arrow element
      • Scale bar element
      • Group element
      • Dynamic text element
      • Table frame
      • Chart frame
    Note:

    The sizes are returned in the unit that is saved with the layout file.

    A sample output JSON

    [{
      "layoutTemplate": "A4 Landscape",      //name of the layout
      "pageSize": [29.7, 21],                //page size
      "pageUnits": "CENTIMETER",             //page units
      "activeDataFrameSize": [27.75, 15.91], //size of the map frame
      "layoutOptions": {
        "hasAuthorText": true,               //is the predefined AuthorText available
        "hasCopyrightText": true,            //is the predefined CopyrightText available
        "hasTitleText": true,                //is the predefined TitleText available
        "hasLegend": true,                   //is the legend element available
        "customTextElements": []             //available list of custom text elements
        "mapSurroundInfos": [{}]             //available list of map surrounds
      }
    },
    {
      "layoutTemplate": "MyTemplatesWithCustomTextElements",
      "pageSize": [11, 8.5],
      "pageUnits": "INCH",
      "activeDataFrameSize": [6.65, 7.34],
      "layoutOptions": {
        "hasAuthorText": false,
        "hasCopyrightText": true,
        "hasTitleText": true,
        "hasLegend": true,
        "customTextElements": [
          { "CityName": "Redlands" },
          { "MapCenterCoordinates": ""},
          { "SelectedParcelID": ""}
        ],
        "mapSurroundInfos": [
        { 
          "name": "North Arrow",
          "type": "CIMMarkerNorthArrow",
          "visible": true
        }
    ] 
    }
    }]
  • Use the same folder location that is used by the associated Export Web Map tool.

  • For more information, see Printing in web applications in the ArcGIS Enterprise help.

Parameters

LabelExplanationData Type
Layout Templates Folder
(Optional)

The full path to the folder where the layout files (.pagx) that will be used as layout templates are located. The default location is <install_directory>\Resources\ArcToolBox\Templates\ExportWebMapTemplates.

Folder
Layout Item ID
(Optional)

The portal ID (in JSON format) of the layout item that will be used for templates. Use the format {"id": "<portal-id>"}.

String

Derived Output

LabelExplanationData Type
JSON String

A JSON formatted string. The string is a list of available .pagx files and additional information. See the tool's usage tips for more information.

String

arcpy.server.GetLayoutTemplatesInfo({Layout_Templates_Folder}, {Layout_Item_ID})
NameExplanationData Type
Layout_Templates_Folder
(Optional)

The full path to the folder where the layout files (.pagx) that will be used as layout templates are located. The default location is <install_directory>\Resources\ArcToolBox\Templates\ExportWebMapTemplates.

Folder
Layout_Item_ID
(Optional)

The portal ID (in JSON format) of the layout item that will be used for templates. Use the format {"id": "<portal-id>"}.

String

Derived Output

NameExplanationData Type
Output_JSON

A JSON formatted string. The string is a list of available .pagx files and additional information. See the tool's usage tips for more information.

String

Code sample

GetLayoutTemplatesInfo example (Python window)

The following script returns a list of metadata for each layout.

import arcpy
arcpy.server.GetLayoutTemplatesInfo(r'C:\Data\MyLayouts')

Environments

This tool does not use any geoprocessing environments.

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics