Add Product

Description

LicenseLicense:

The use of this resource requires an ArcGIS GIS Server Advanced license and a Production Mapping Server or Defense Mapping Server license.

The addProduct operation adds a definition of a map product to the Topographic Production Service resource that can be used to generate a map.

Request parameters

Parameter

Details

productDefinition

(Required)

The JSON definition of a map product. More details are provided in the following section.

raster

(Optional)

The path to a raster on disk (server path).

ancillaryLayers

(Optional)

A JSON array of additional layers to include in the final product.

Syntax:

[
{
"layer": "url of the layer",
"featureClass": "name of the feature class to extract to",
"map": "name of the map the layer will be inserted into",
"layerIndex": "insertion index of the layer"
},
...
]

NoteNote:

This parameter supports services located in the same portal site as the server object extension (SOE) or services that are publicly available. The featureClass, map, and layerIndex properties in the array are optional. If the dataset is identifiable from the feature service, it is not necessary to provide the featureClass property. The default values are 0 for layerIndex and BaseMap for map.

productDefinition properties

The following are additional details about the productDefinition parameter:

Property

Details

version

Indicates the serialization version, currently at version 0.

name

The name of the product. It must be unique in the map service.

type

Indicates the product type. Valid values include MTM, TDS, JOG, CTM, and Custom.

gridType

Indicates the type of grid XML to use when running grid operations.

description

Describes the type of map product being produced.

sheetIDField

The field name identifying the area of interest (AOI) for which the product is generated. This must be a field that exists on the features used as the area of interest.

productVersions

The JSON array of versions for this product. A version is a json object with two properties, name and template.

A template can be either the full path to a layout template on a disk or the file name of a template installed with Defense Mapping product files.

resources

A json array of resources. A resource is a json object with three properties: name, type, and value. It provides values to operation parameters at run time.

There are six types of resources:

  • Workspace—Type is 3.
  • Layer—Type is 2.
  • Layout—Type is 6.
  • GridLocator—Type is 4.
  • Value—Type is 1.
  • ProductFiles—Type is 7.

To use a resource in an operation parameter, place brackets around its name. In the following example, the resource SheetID is defined, and the LayerProperties operation has a parameter named definition_query and the value is set to NRN = '[SheetID]'. At runtime, [SheetID] is replaced with the Sheet Identifier of the map being generated.

{
  "resources": [
  {
    "name": "SheetID",
    "type": 1,
    "value": ""
  }
  ...
  ],
  "operations": [ 
  { 
    "name": "LayerProperties", 
    "type": 12, 
    "description": "Update Layer in Map", 
    "parameters": [
        { 
            "name": "in_layer", 
            "value": "ASG_Layer" 
        }, 
        { 
            "name": "definition_query", 
            "value": "NRN = '[SheetID]'" 
        }
        ...
    ]
  }
}

These are predefined resources known to the SOE. The values of these resources are left blank in the json definition and the SOE sets the value at runtime. For example, the SourceWorkspace resource is set at runtime with the data from the map service. You can look at map product definitions released in Defense Mapping product files to see how resources are used.

operations

An operation is typically a geoprocessing operation, but there are also other types of operations. Operation types are predefined by the app so that it can optimize the execution of operations. There are 11 operation types:

  • ASG—Type is 2. This operation creates adjoining sheets guide data.
  • EGB—Type is 3. This operation creates elevation guide data.
  • Grid—Type is 4. This operation creates grids for a map.
  • PMI—Type is 5. This operation populates map sheet information.
  • Anno—Type is 6. This operation converts labels into annotation.
  • CreateMask—Type is 7. This operation creates polygon masks for features.
  • ApplyMask—Type is 8. This operation applies layer masking properties in a map.
  • Contours—Type is 9. This operation creates contour features.
  • FeatureOffset—Type is 10. This operation applies offsets to features.
  • MapResource—Type is 11. This operation updates data sources in the map.
  • LayerProperties—Type is 12. This operation sets map layer properties.

A json array of operations. An operation is a json object with the following parameters:

{
"name": <the name of the operation>,
"type": <the value indicating the type of operation>,
"description": <the string describing the operation>,
"parameters": <a json array of parameters, which is a json object with two values:>,
 [
  {
    "name": <name of operation>,
    "value": <value of parameter>
  }
 ]
}

Example operation:

{
  "name": "MapResource",
  "type": 11,
  "description": "Update BaseMap DataSources",
  "parameters":
 [
  {
   "name": "in_map",
   "value": "BaseMap"
  }
 ]
}

You can look at map product definitions released in Defense Mapping product files to see how operations are used.

Request example

The following is an example of the productDefinition parameter:

{
	"version": 0,
	"name": "ExampleProduct",
	"type": "MTM",
	"gridType": "TM50",
	"description": "Test Masking Product",
	"sheetIDField": "NRN",
	"productVersions": [
		{
			"name": "TRD_4_5",
			"template": "MTM50_Layout.pagx"
		}
	],
	"resources": [
	{
		"name": "SourceWorkspace",
		"type": 3,
		"value": ""
	},
	{
		"name": "AOILayer",
		"type": 2,
		"value": ""
	},
	{
		"name": "SheetID",
		"type": 1,
		"value": ""
	},
	{
		"name": "Layout",
		"type": 6,
		"value": ""
	},
	{
		"name": "ProductFiles",
		"type": 7,
		"value": ""
	}
	],
	"operations": [
	{
		"name": "MapResource",
		"type": 11,
		"description": "Update BaseMap DataSources",
		"parameters": [
			{
				"name": "in_map",
				"value": "BaseMap"
			}
		]
	},
	{
		"name": "Grid",
		"type": 4,
		"description": "BaseMap Grid",
		"toolName": "MakeGridsAndGraticulesLayer_topographic",
		"validation": 2,
		"properties" : {
			"type" : "PropertySet",
			"propertySetItems" : [
				"AddOutputToMap",
				"BaseMap"
			]
		},
		"parameters": [
			{
				"name": "in_grid_xml",
				"value": "[GridLocator]\\BaseMap"
			},
			{
				"name": "area_of_interest",
				"value": "[AOILayer]"
			},
			{
				"name": "target_feature_dataset",
				"value": "[SourceWorkspace]\\BM_GRD"
			},
			{
				"name": "out_layer_name",
				"value": "BMGrid"
			},
			{
				"name": "grid_name",
				"value": "BMGrid"
			},
			{
				"name": "configure_layout",
				"value": "CONFIGURE_LAYOUT"
			},
			{
				"name": "layout",
				"value": "[Layout]"
			},
			{
				"name": "map_frame",
				"value": "BaseMap Map Frame"
			}
		]
	},
	{
		"name": "CreateMasks",
		"type": 7,
		"description": "Create Masks for Base Map",
		"toolName": "MakeMasksFromRules_topographic",
		"validation": 2,
		"properties" : {
			"type" : "PropertySet",
			"propertySetItems" : [
				"MapName",
				"BaseMap"
			]
		},
		"parameters": [
			{
				"name": "in_map",
				"value": "BaseMap"
			},
			{
				"name": "rule_file",
				"value": "[ProductFiles]\\MTM_Basemap_Masking_Rules.xml"
			},
			{
				"name": "out_feature_dataset",
				"value": "[SourceWorkspace]\\Masks"
			}
		]
	},
	{
		"name": "ApplyMasks",
		"type": 7,
		"description": "Apply Masks for Base Map",
		"toolName": "ApplyMasksFromRules_topographic",
		"validation": 2,
		"properties" : {
			"type" : "PropertySet",
			"propertySetItems" : [
				"MapName",
				"BaseMap"
			]
		},
		"parameters": [
			{
				"name": "in_map",
				"value": "BaseMap"
			},
			{
				"name": "rule_file",
				"value": "[ProductFiles]\\MTM_Basemap_Masking_Rules.xml"
			},
			{
				"name": "in_feature_dataset",
				"value": "[SourceWorkspace]\\Masks"
			}
		]
	}
 ]
}

Example usage

The following URL is an example of the addProduct REST operation:

https://machine.domain.com/server/rest/services/SampleService/TopographicProductionServer/addProduct?productDefinition=&raster=&ancillaryLayers=&f=json

JSON Response syntax

The following is the syntax of a response:

{
"success" : true | false
}

JSON Response example

The following is an example of a response:

{
 "productName": "ExampleProduct",
 "success": true
}

JSON Response example

The following is an example of an error response:

{
 "error": {
  "code": -2147211754,
  "message": "Map product ExampleProduct already exists. Map product names must be unique.",
  "details": [   
  ]
 }
}