nodes: 0, module; 1, function_definition; 2, function_name:exportImage; 3, parameters; 4, block; 5, identifier:self; 6, identifier:bbox; 7, identifier:imageSR; 8, identifier:bboxSR; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, default_parameter; 15, default_parameter; 16, default_parameter; 17, default_parameter; 18, default_parameter; 19, default_parameter; 20, default_parameter; 21, default_parameter; 22, default_parameter; 23, default_parameter; 24, expression_statement; 25, expression_statement; 26, expression_statement; 27, expression_statement; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, expression_statement; 32, if_statement; 33, if_statement; 34, if_statement; 35, if_statement; 36, if_statement; 37, if_statement; 38, if_statement; 39, if_statement; 40, if_statement; 41, if_statement; 42, expression_statement; 43, if_statement; 44, identifier:size; 45, list; 46, identifier:time; 47, None; 48, identifier:format; 49, string:"jpgpng"; 50, identifier:pixelType; 51, string:"UNKNOWN"; 52, identifier:noData; 53, None; 54, identifier:noDataInterpretation; 55, string:"esriNoDataMatchAny"; 56, identifier:interpolation; 57, None; 58, identifier:compression; 59, None; 60, identifier:compressionQuality; 61, integer:75; 62, identifier:bandIds; 63, None; 64, identifier:moasiacRule; 65, None; 66, identifier:renderingRule; 67, string:""; 68, identifier:f; 69, string:"json"; 70, identifier:saveFolder; 71, None; 72, identifier:saveFile; 73, None; 74, comment:"""
          The exportImage operation is performed on an image service resource
          The result of this operation is an image resource. This resource
          provides information about the exported image, such as its URL,
          extent, width, and height.
          In addition to the usual response formats of HTML and JSON, you can
          also request the image format while performing this operation. When
          you perform an export with the image format , the server responds
          by directly streaming the image bytes to the client. With this
          approach, you don't get any information associated with the
          exported image other than the image itself.
  
          Inputs:
             bbox - The extent (bounding box) of the exported image. Unless
                    the bboxSR parameter has been specified, the bbox is
                    assumed to be in the spatial reference of the image
                    service.
             imageSR - The spatial reference of the exported image.
             bboxSR - The spatial reference of the bbox.
             size - The size (width * height) of the exported image in
                    pixels. If size is not specified, an image with a default
                    size of 400 * 400 will be exported.
             time - The time instant or the time extent of the exported image.
             format - The format of the exported image. The default format is
                      jpgpng.
                      Values: jpgpng | png | png8 | png24 | jpg | bmp | gif |
                              tiff | png32
             pixelType - The pixel type, also known as data type, pertains to
                         the type of values stored in the raster, such as
                         signed integer, unsigned integer, or floating point.
                         Integers are whole numbers, whereas floating points
                         have decimals.
             noDate - The pixel value representing no information.
             noDataInterpretation - Interpretation of the noData setting. The
                                 default is esriNoDataMatchAny when noData is
                                 a number, and esriNoDataMatchAll when noData
                                 is a comma-delimited string:
                                 esriNoDataMatchAny | esriNoDataMatchAll.
             interpolation - The resampling process of extrapolating the
                             pixel values while transforming the raster
                             dataset when it undergoes warping or when it
                             changes coordinate space.
             compression - Controls how to compress the image when exporting
                           to TIFF format: None, JPEG, LZ77. It does not
                           control compression on other formats.
             compressionQuality - Controls how much loss the image will be
                                  subjected to by the compression algorithm.
                                  Valid value ranges of compression quality
                                  are from 0 to 100.
             bandIds - If there are multiple bands, you can specify a single
                       band to export, or you can change the band combination
                       (red, green, blue) by specifying the band number. Band
                       number is 0 based.
             mosaicRule - Specifies the mosaic rule when defining how
                          individual images should be mosaicked. When a mosaic
                          rule is not specified, the default mosaic rule of
                          the image service will be used (as advertised in
                          the root resource: defaultMosaicMethod,
                          mosaicOperator, sortField, sortValue).
             renderingRule - Specifies the rendering rule for how the
                             requested image should be rendered.
             f - The response format.  default is json
                 Values: json | image | kmz
          """; 75, assignment; 76, assignment; 77, assignment; 78, assignment; 79, assignment; 80, assignment; 81, assignment; 82, call; 83, block; 84, comparison_operator:format in __allowedFormat; 85, block; 86, call; 87, block; 88, boolean_operator; 89, block; 90, boolean_operator; 91, block; 92, comparison_operator:noDataInterpretation in __allowedInterpolation; 93, block; 94, comparison_operator:noData is not None; 95, block; 96, boolean_operator; 97, block; 98, boolean_operator; 99, block; 100, comparison_operator:renderingRule is not None; 101, block; 102, assignment; 103, comparison_operator:f == "json"; 104, block; 105, elif_clause; 106, elif_clause; 107, integer:400; 108, integer:400; 109, identifier:params; 110, dictionary; 111, identifier:url; 112, binary_operator:self._url + "/exportImage"; 113, identifier:__allowedFormat; 114, list; 115, identifier:__allowedPixelTypes; 116, list; 117, identifier:__allowednoDataInt; 118, list; 119, identifier:__allowedInterpolation; 120, list; 121, identifier:__allowedCompression; 122, list; 123, identifier:isinstance; 124, argument_list; 125, expression_statement; 126, identifier:format; 127, identifier:__allowedFormat; 128, expression_statement; 129, identifier:isinstance; 130, argument_list; 131, expression_statement; 132, boolean_operator; 133, line_continuation:\; 134, call; 135, expression_statement; 136, comparison_operator:pixelType is not None; 137, line_continuation:\; 138, comparison_operator:pixelType in __allowedPixelTypes; 139, expression_statement; 140, identifier:noDataInterpretation; 141, identifier:__allowedInterpolation; 142, expression_statement; 143, identifier:noData; 144, None; 145, expression_statement; 146, comparison_operator:compression is not None; 147, line_continuation:\; 148, comparison_operator:compression in __allowedCompression; 149, expression_statement; 150, comparison_operator:bandIds is not None; 151, line_continuation:\; 152, call; 153, expression_statement; 154, identifier:renderingRule; 155, None; 156, expression_statement; 157, subscript; 158, identifier:f; 159, identifier:f; 160, string:"json"; 161, return_statement; 162, comparison_operator:f == "image"; 163, block; 164, comparison_operator:f == "kmz"; 165, block; 166, pair; 167, pair; 168, pair; 169, pair; 170, pair; 171, pair; 172, attribute; 173, string:"/exportImage"; 174, string:"jpgpng"; 175, string:"png"; 176, string:"png8"; 177, string:"png24"; 178, string:"jpg"; 179, string:"bmp"; 180, string:"gif"; 181, string:"tiff"; 182, string:"png32"; 183, string:"C128"; 184, string:"C64"; 185, string:"F32"; 186, string:"F64"; 187, string:"S16"; 188, string:"S32"; 189, string:"S8"; 190, string:"U1"; 191, string:"U16"; 192, string:"U2"; 193, string:"U32"; 194, string:"U4"; 195, string:"U8"; 196, string:"UNKNOWN"; 197, string:"esriNoDataMatchAny"; 198, string:"esriNoDataMatchAll"; 199, string:"RSP_BilinearInterpolation"; 200, string:"RSP_CubicConvolution"; 201, string:"RSP_Majority"; 202, string:"RSP_NearestNeighbor"; 203, string:"JPEG"; 204, string:"LZ77"; 205, identifier:moasiacRule; 206, identifier:MosaicRuleObject; 207, assignment; 208, assignment; 209, identifier:time; 210, attribute; 211, assignment; 212, comparison_operator:interpolation is not None; 213, line_continuation:\; 214, comparison_operator:interpolation in __allowedInterpolation; 215, identifier:isinstance; 216, argument_list; 217, assignment; 218, identifier:pixelType; 219, None; 220, identifier:pixelType; 221, identifier:__allowedPixelTypes; 222, assignment; 223, assignment; 224, assignment; 225, identifier:compression; 226, None; 227, identifier:compression; 228, identifier:__allowedCompression; 229, assignment; 230, identifier:bandIds; 231, None; 232, identifier:isinstance; 233, argument_list; 234, assignment; 235, assignment; 236, identifier:params; 237, string:"f"; 238, call; 239, identifier:f; 240, string:"image"; 241, expression_statement; 242, return_statement; 243, identifier:f; 244, string:"kmz"; 245, return_statement; 246, string:"bbox"; 247, identifier:bbox; 248, string:"imageSR"; 249, identifier:imageSR; 250, string:"bboxSR"; 251, identifier:bboxSR; 252, string:"size"; 253, binary_operator:"%s %s" % (size[0], size[1]); 254, string:"pixelType"; 255, identifier:pixelType; 256, string:"compressionQuality"; 257, identifier:compressionQuality; 258, identifier:self; 259, identifier:_url; 260, subscript; 261, attribute; 262, subscript; 263, identifier:format; 264, identifier:datetime; 265, identifier:datetime; 266, subscript; 267, call; 268, identifier:interpolation; 269, None; 270, identifier:interpolation; 271, identifier:__allowedInterpolation; 272, identifier:interpolation; 273, identifier:str; 274, subscript; 275, identifier:interpolation; 276, subscript; 277, identifier:pixelType; 278, subscript; 279, identifier:noDataInterpretation; 280, subscript; 281, identifier:noData; 282, subscript; 283, identifier:compression; 284, identifier:bandIds; 285, identifier:list; 286, subscript; 287, call; 288, subscript; 289, identifier:renderingRule; 290, attribute; 291, argument_list; 292, assignment; 293, identifier:result; 294, call; 295, string:"%s %s"; 296, tuple; 297, identifier:params; 298, string:"moasiacRule"; 299, identifier:moasiacRule; 300, identifier:value; 301, identifier:params; 302, string; 303, identifier:params; 304, string; 305, identifier:local_time_to_online; 306, argument_list; 307, identifier:params; 308, string; 309, identifier:params; 310, string; 311, identifier:params; 312, string; 313, identifier:params; 314, string; 315, identifier:params; 316, string; 317, identifier:params; 318, string; 319, attribute; 320, argument_list; 321, identifier:params; 322, string; 323, identifier:self; 324, identifier:_get; 325, keyword_argument; 326, keyword_argument; 327, keyword_argument; 328, keyword_argument; 329, keyword_argument; 330, identifier:result; 331, call; 332, attribute; 333, argument_list; 334, subscript; 335, subscript; 336, string_content:format; 337, string_content:time; 338, identifier:time; 339, string_content:interpolation; 340, string_content:pixelType; 341, string_content:noDataInterpretation; 342, string_content:noData; 343, string_content:compression; 344, string_content:bandIds; 345, string:","; 346, identifier:join; 347, identifier:bandIds; 348, string_content:renderingRule; 349, identifier:url; 350, identifier:url; 351, identifier:param_dict; 352, identifier:params; 353, identifier:securityHandler; 354, attribute; 355, identifier:proxy_port; 356, attribute; 357, identifier:proxy_url; 358, attribute; 359, attribute; 360, argument_list; 361, identifier:self; 362, identifier:_get; 363, keyword_argument; 364, keyword_argument; 365, keyword_argument; 366, keyword_argument; 367, keyword_argument; 368, keyword_argument; 369, keyword_argument; 370, identifier:size; 371, integer:0; 372, identifier:size; 373, integer:1; 374, identifier:self; 375, identifier:_securityHandler; 376, identifier:self; 377, identifier:_proxy_port; 378, identifier:self; 379, identifier:_proxy_url; 380, identifier:self; 381, identifier:_get; 382, keyword_argument; 383, keyword_argument; 384, keyword_argument; 385, keyword_argument; 386, keyword_argument; 387, keyword_argument; 388, keyword_argument; 389, identifier:url; 390, identifier:url; 391, identifier:param_dict; 392, identifier:params; 393, identifier:securityHandler; 394, attribute; 395, identifier:proxy_url; 396, attribute; 397, identifier:proxy_port; 398, attribute; 399, identifier:out_folder; 400, identifier:saveFolder; 401, identifier:file_name; 402, identifier:saveFile; 403, identifier:url; 404, identifier:url; 405, identifier:param_dict; 406, identifier:params; 407, identifier:securityHandler; 408, attribute; 409, identifier:proxy_url; 410, attribute; 411, identifier:proxy_port; 412, attribute; 413, identifier:out_folder; 414, identifier:saveFolder; 415, identifier:file_name; 416, identifier:saveFile; 417, identifier:self; 418, identifier:_securityHandler; 419, identifier:self; 420, identifier:_proxy_url; 421, identifier:self; 422, identifier:_proxy_port; 423, identifier:self; 424, identifier:_securityHandler; 425, identifier:self; 426, identifier:_proxy_url; 427, identifier:self; 428, identifier:_proxy_port
code: def exportImage(self,
                      bbox,
                      imageSR,
                      bboxSR,
                      size=[400,400],
                      time=None,
                      format="jpgpng",
                      pixelType="UNKNOWN",
                      noData=None,
                      noDataInterpretation="esriNoDataMatchAny",
                      interpolation=None,
                      compression=None,
                      compressionQuality=75,
                      bandIds=None,
                      moasiacRule=None,
                      renderingRule="",
                      f="json",
                      saveFolder=None,
                      saveFile=None
                      ):
          """
          The exportImage operation is performed on an image service resource
          The result of this operation is an image resource. This resource
          provides information about the exported image, such as its URL,
          extent, width, and height.
          In addition to the usual response formats of HTML and JSON, you can
          also request the image format while performing this operation. When
          you perform an export with the image format , the server responds
          by directly streaming the image bytes to the client. With this
          approach, you don't get any information associated with the
          exported image other than the image itself.
  
          Inputs:
             bbox - The extent (bounding box) of the exported image. Unless
                    the bboxSR parameter has been specified, the bbox is
                    assumed to be in the spatial reference of the image
                    service.
             imageSR - The spatial reference of the exported image.
             bboxSR - The spatial reference of the bbox.
             size - The size (width * height) of the exported image in
                    pixels. If size is not specified, an image with a default
                    size of 400 * 400 will be exported.
             time - The time instant or the time extent of the exported image.
             format - The format of the exported image. The default format is
                      jpgpng.
                      Values: jpgpng | png | png8 | png24 | jpg | bmp | gif |
                              tiff | png32
             pixelType - The pixel type, also known as data type, pertains to
                         the type of values stored in the raster, such as
                         signed integer, unsigned integer, or floating point.
                         Integers are whole numbers, whereas floating points
                         have decimals.
             noDate - The pixel value representing no information.
             noDataInterpretation - Interpretation of the noData setting. The
                                 default is esriNoDataMatchAny when noData is
                                 a number, and esriNoDataMatchAll when noData
                                 is a comma-delimited string:
                                 esriNoDataMatchAny | esriNoDataMatchAll.
             interpolation - The resampling process of extrapolating the
                             pixel values while transforming the raster
                             dataset when it undergoes warping or when it
                             changes coordinate space.
             compression - Controls how to compress the image when exporting
                           to TIFF format: None, JPEG, LZ77. It does not
                           control compression on other formats.
             compressionQuality - Controls how much loss the image will be
                                  subjected to by the compression algorithm.
                                  Valid value ranges of compression quality
                                  are from 0 to 100.
             bandIds - If there are multiple bands, you can specify a single
                       band to export, or you can change the band combination
                       (red, green, blue) by specifying the band number. Band
                       number is 0 based.
             mosaicRule - Specifies the mosaic rule when defining how
                          individual images should be mosaicked. When a mosaic
                          rule is not specified, the default mosaic rule of
                          the image service will be used (as advertised in
                          the root resource: defaultMosaicMethod,
                          mosaicOperator, sortField, sortValue).
             renderingRule - Specifies the rendering rule for how the
                             requested image should be rendered.
             f - The response format.  default is json
                 Values: json | image | kmz
          """
          params = {
              "bbox" : bbox,
              "imageSR": imageSR,
              "bboxSR": bboxSR,
              "size" : "%s %s" % (size[0], size[1]),
              "pixelType" : pixelType,
              "compressionQuality" : compressionQuality,
  
          }
          url = self._url + "/exportImage"
          __allowedFormat = ["jpgpng", "png",
                             "png8", "png24",
                             "jpg", "bmp",
                             "gif", "tiff",
                             "png32"]
          __allowedPixelTypes = [
              "C128", "C64", "F32",
              "F64", "S16", "S32",
              "S8", "U1", "U16",
              "U2", "U32", "U4",
              "U8", "UNKNOWN"
          ]
          __allowednoDataInt = [
              "esriNoDataMatchAny",
              "esriNoDataMatchAll"
          ]
          __allowedInterpolation = [
              "RSP_BilinearInterpolation",
              "RSP_CubicConvolution",
              "RSP_Majority",
              "RSP_NearestNeighbor"
          ]
          __allowedCompression = [
              "JPEG", "LZ77"
          ]
          if isinstance(moasiacRule,MosaicRuleObject):
              params["moasiacRule"] = moasiacRule.value
          if format in __allowedFormat:
              params['format'] = format
          if isinstance(time, datetime.datetime):
              params['time'] = local_time_to_online(time)
          if interpolation is not None and \
             interpolation in __allowedInterpolation and \
             isinstance(interpolation, str):
              params['interpolation'] = interpolation
          if pixelType is not None and \
             pixelType in __allowedPixelTypes:
              params['pixelType'] = pixelType
          if noDataInterpretation in __allowedInterpolation:
              params['noDataInterpretation']  = noDataInterpretation
          if noData is not None:
              params['noData'] = noData
          if compression is not None and \
             compression in __allowedCompression:
              params['compression'] = compression
          if bandIds is not None and \
             isinstance(bandIds, list):
              params['bandIds'] = ",".join(bandIds)
          if renderingRule is not None:
              params['renderingRule'] = renderingRule
          params["f" ] = f
          if f == "json":
              return self._get(url=url,
                                  param_dict=params,
                                  securityHandler=self._securityHandler,
                                  proxy_port=self._proxy_port,
                                  proxy_url=self._proxy_url)
          elif f == "image":
              result = self._get(url=url,
                                 param_dict=params,
                                 securityHandler=self._securityHandler,
                                 proxy_url=self._proxy_url,
                                 proxy_port=self._proxy_port,
                                 out_folder=saveFolder,
                                 file_name=saveFile)
              return result
          elif f == "kmz":
              return self._get(url=url,
                               param_dict=params,
                               securityHandler=self._securityHandler,
                               proxy_url=self._proxy_url,
                               proxy_port=self._proxy_port,
                               out_folder=saveFolder,
                               file_name=saveFile)