Here is a Python sample that can be used to clip items from your image service, package them into a mosaic dataset with all the metadata field values, and then ship them to a client or colleague. As with all other code samples that we add to our gallery, it is meant to help show you how something can be done in code; the actual implementation may need some altering in order for it to work for your particular example.
Description:
This python sample application accepts a input image service layer or URL as input. You can draw a polygon feature to define an area on the image service that you want to clip.
The program will start creating a local mosaic dataset with all metadata field recovered from the image service. And then it will download the image service item one by one according to the geometry of the polygon, and clip the image using the polygon.
You also have the option to clip the image using the default raster function if there is any. And you can also define the output image’s cell size.
The downloaded image will be added back to the local mosaic dataset along with all the metadata field values from the image service.
Note:
This python scripting tool uses the 10.1 Image Server REST API. Some of the functionality, such as define output image spatial reference in the ExportImage REST request is not available in 10.0. This is only a sample, and you may need to alter it, order for it to work for your particular case.
Submitted by: Jie Zhang