Image service Measure method
Returns the mensuration result for a given geometry, a mosaic rule, a pixel size, and mensuration operation.
Measure (Geometry From, Geometry To, MosaicRule MosaicRule, Point Pixelsize, esriMensurationOperation Operation)
Parameter |
Description |
---|---|
From |
The From geometry. |
To | The To geometry (required for height measurement). |
MosaicRule | A mosaic rule defining the image sorting order. |
PixelSize | A point that defines the pixel size level being measured. |
esriMensurationOperation | The mensuration operation type. |
Return Value
The ImageServerMeasureResult object.
Remarks
The ImageServerMeasureResult contains the name of the raster being measured, associated sensor name, operation type, and a measurement property set. The measurement property set consists of measured value (height, distance, angle, centroid, area, or perimeter), unit, and uncertainty.
The esriMensurationOperation includes:
- esriMensurationAreaAndPerimeter: Measures the area and perimeter of a polygon.
- esriMensurationCentroid: Measures the centroid of a geometry.
- esriMensurationDistanceAndAngle: Measures distance and angle of a line segment.
- esriMensurationHeightFromBaseAndTop: Measures height using building base and top.
- esriMensurationHeightFromBaseAndTopShadow: Measures height using building base and shadow of top.
- esriMensurationHeightFromTopAndTopShadow: Measures height using building top and shadow of top.
- esriMensurationPoint: Measure a point location.
Examples
C#
//define image server
UploadTest_ImageServer imageServer = new UploadTest_ImageServer();
imageServer.Url = _serviceurl;
//define from to points
SpatialReference wgs84 = new GeographicCoordinateSystem();
wgs84.WKID = 4326;
wgs84.WKIDSpecified = true;
PointN from = new PointN();
from.X = -111.19944857;
from.Y = 32.05586888;
from.SpatialReference = wgs84;
PointN to = new PointN();
to.X = -111.19940048;
to.Y = 32.05589815;
to.SpatialReference = wgs84;
//define a mosaic rule
MosaicRule mrule = new MosaicRule();
mrule.MosaicMethod = esriMosaicMethod.esriMosaicLockRaster;
mrule.LockRasterID = "2";
//define pixel size
PointN resolution = new PointN();
resolution.X = 0.2;
resolution.Y = 0.2;
//measure
ImageServerMeasureResult measureResult = imageServer.Measure(from, to, mrule, resolution, esriMensurationOperation.esriMensurationHeightFromBaseAndTop);
//log results
for (int i=0; i<measureResult.Measurement.PropertyArray.Length; i++)
{
PropertySetProperty prop = measureResult.Measurement.PropertyArray[i];
if (prop.Value is double)
Console.WriteLine("{0}: {1}", prop.Key, (double)prop.Value);
if (prop.Value is string)
Console.WriteLine("{0}: {1}", prop.Key, (string)prop.Value);
}