Image service Add method

Adds rasters to image service.

Add(RasterItemDescription[] RasterItemDescriptions)

Parameter

Description

RasterItemDescription[]

An array of RasterItemDescription object.

Return Value

An array of ImageServerEditResult object.

Remarks

Use this method to add raster datasets, or other supported raster types (defined by the image service) to an image service. RasterItemDescription describes all required information, including name and location of the raster files (through shared path or HTTP), visibility range, and attribute values etc. If the source rasters are not georeferenced, georeferncing information (geodataTransformations) can be specified in RasterItemDescription.

ImageServerEditResult contains the raster ID being added.

Examples

C#

//define image server
UploadTest_ImageServer imageServer = new UploadTest_ImageServer();
imageServer.Url = _serviceurl;

//define raster item description
string[] urls = new string[] { "http://istest/cal/tile1/tile1.tif", "http://istest/cal/tile1/tile1.aux.xml", "http://istest/cal/tile1/tile1.tfw", "http://istest/cal/tile1/tile1.ovr" };
string[] names = new string[] { "tile1.tif", "tile1.aux.xml", "tile1.tfw" };
RasterItemDescription itemDescription = new RasterItemDescription();
itemDescription.DataFileURLs = urls;
itemDescription.DataFileNames = names;
itemDescription.BuildThumbnail = true;
itemDescription.BuildThumbnailSpecified = true;
itemDescription.Type = "Raster Dataset";
PropertySetProperty prop = new PropertySetProperty();
prop.Key = "MyField";
prop.Value = "MyValue";
PropertySet propSet = new PropertySet();
propSet.PropertyArray = new PropertySetProperty[] { prop };
itemDescription.Properties = propSet;

//define transformation (if not georeferenced)
PolynomialXform polyXform = new PolynomialXform();
polyXform.SourceGCPs = new double[]{0,0, 100, 100, 0,100};
polyXform.TargetGCPs = new double[] { 100, 100, 300, 300, 100, 300 };
polyXform.PolynomialOrder = 1;
polyXform.PolynomialOrderSpecified = true;
polyXform.SpatialReference = ((EnvelopeN)imageServer.GetServiceInfo().Extent).SpatialReference;
itemDescription.GeodataXform = polyXform;

//add
ImageServerEditResult[] editResults = imageServer.Add(new RasterItemDescription[] { itemDescription });

//log results
Console.Write("objectID:");
for (int i = 0; i < editResults.Length; i++)
      Console.WriteLine("RID: {0}, status: {1}", editResults[i].RasterID,editResults[i].Succeeded);

11/8/2016