ArcGIS Server中的 Image Service 能夠提供對影像原始數據的動態訪問,得到其元數據(metadata):
包括自定義的空間參考,圖幅範圍,像元大小,像元類型,波段數,以及各波段的基礎統計信息(最小值,最大值,平均值之
類);能夠根據相關參數生成新的影像,同時在arcgis server 10版本中還添加了針對柵格數據的查詢和下載功能。最重要的是不同
於map service(不論是cache或non-cache),能夠對影像做一些處理,比如計算NDVI,坡度,坡向,進行Standard Deviation拉
伸、直方圖均勻化拉伸,minmax拉伸等基本處理。雖然和專門的影像處理軟件完全不能比較,但是能在網絡上進行遙感影像處理。
爲了能利用ArcGIS Flex API瀏覽ImageServer服務並對柵格地圖進行渲染,我參考了ArcGIS有關服務的幫助和例子http:/
講解了ImageServer服務幾種柵格渲染的方法,ArcGISImageServiceLayer是通過renderingRule來進行渲染的,
但renderingRule的類型爲RasterFunction,看到RasterFunction中的functionName和arguments屬性,這讓我一頭霧水。
"rasterFunction" : "Aspect"
The Aspect
raster function takes no arguments. Hence, specifying only the rasterFunction
property
suffices in this case.
{ "rasterFunction" : "Aspect" }
"rasterFunction" : "Colormap"
The arguments for the Colormap
function are as shown below:
{
"rasterFunction" : "Colormap",
"rasterFunctionArguments" : {
"ColormapName" : "<Random | NDVI | Elevation | Gray>",
"Colormap" : [
[<value1>, <red1>, <green1>, <blue1>], //[int, int, int, int]
[<value2>, <red2>, <green2>, <blue2>]
]
},
"variableName" : "Raster"
}
Example 1:
{ "rasterFunction" : "Colormap", "rasterFunctionArguments" : { "ColormapName" : "Random" }, "variableName" : "Raster" }
Example 2:
{ "rasterFunction" : "Colormap", "rasterFunctionArguments" : { "Colormap" : [ [0, 1, 2, 3], [2, 45, 52, 13] ] }, "variableName" : "Raster" }
"rasterFunction" : "Hillshade"
The arguments for the Hillshade
function are as shown below:
{ "rasterFunction" : "Hillshade", "rasterFunctionArguments" : { "Azimuth" : <Azimuth>, //double (e.g. 215.0) "Altitude" : <Altitude>, //double (e.g. 75.0) "ZFactor" : <ZFactor> //double (e.g. 0.3) }, "variableName" : "DEM" }
Example:
{ "rasterFunction" : "Hillshade", "rasterFunctionArguments" : { "Azimuth" : 215.0, "Altitude" : 75.0, "ZFactor" : 0.3 }, "variableName" : "DEM" }
"rasterFunction" : "NDVI"
The arguments for the NDVI
function are as shown below:
{ "rasterFunction" : "NDVI", "rasterFunctionArguments" : { "VisibleBandID" : <VisibleBandID>, //int (zero-based band id, e.g. 2) "InfraredBandID" : <InfraredBandID> //int (zero-based band id, e.g. 1) }, "variableName" : "Raster" }
Example:
{ "rasterFunction" : "NDVI", "rasterFunctionArguments" : { "VisibleBandID" : 2, "InfraredBandID" : 1 }, "variableName" : "Raster" }
"rasterFunction" : "ShadedRelief"
The arguments for the ShadedRelief
function are as shown below:
{ "rasterFunction" : "ShadedRelief", "rasterFunctionArguments" : { "Azimuth" : <Azimuth>, //double (e.g. 215.0) "Altitude" : <Altitude>, //double (e.g. 75.0) "ZFactor" : <ZFactor>, //double (e.g. 0.3) "Colormap" : [ [<value1>, <red1>, <green1>, <blue1>], //[int, int, int, int] [<value2>, <red2>, <green2>, <blue2>] ] }, "variableName" : "Raster" }
Example:
{ "rasterFunction" : "ShadedRelief", "rasterFunctionArguments" : { "Azimuth" : 215.0, "Altitude" : 75.0, "ZFactor" : 0.3, "Colormap" : [ [0, 1, 2, 3], [2, 45, 52, 13] ] }, "variableName" : "Raster" }
"rasterFunction" : "Slope"
The arguments for the Slope
function are as shown below:
{
"rasterFunction" : "Slope",
"rasterFunctionArguments" : {
"ZFactor" : <ZFactor> //double (e.g. 0.3)
},
"variableName" : "DEM"
}
Example:
{ "rasterFunction" : "Slope", "rasterFunctionArguments" : { "ZFactor" : 0.3 }, "variableName" : "DEM" }
"rasterFunction" : "Statistics"
The arguments for the Statistics
function are as shown below:
{ "rasterFunction" : "Statistics", "rasterFunctionArguments" : { "Type" : "<Min | Max | Mean | StandardDeviation>", "KernelColumns" : <KernelColumns>, //int (e.g. 3) "KernelRows" : <KernelRows> //int (e.g. 3) }, "variableName" : "Raster" }
Example:
{ "rasterFunction" : "Statistics", "rasterFunctionArguments" : { "Type" : "Mean", "KernelColumns" : 3, "KernelRows" : 3 }, "variableName" : "Raster" }
"rasterFunction" : "Stretch"
The arguments for the Stretch
function are as shown below:
{ "rasterFunction" : "Stretch", "rasterFunctionArguments" : { "StretchType" : <StretchType>, //int (0 = None, 3 = StandardDeviation, 4 = Histogram Equalization, 5 = MinMax) "NumberOfStandardDeviations" : <NumberOfStandardDeviations>, //int (e.g. 2) "Statistics" : [ [<min1>, <max1>, <mean1>, <standardDeviation1>], //[double, double, double, double] [<min2>, <max2>, <mean2>, <standardDeviation2>] ], "Gamma" : [<gamma1>, <gamma2>] //array of doubles }, "variableName" : "Raster" }
Example:
{ "rasterFunction" : "Stretch", "rasterFunctionArguments" : { "StretchType" : 3, "NumberOfStandardDeviations" : 2, "Statistics" : [ [0.2, 222.46, 99.35, 1.64], [5.56, 100.345, 45.4, 3.96], [0, 352.37, 172.284, 2] ], "Gamma" : [1.25, 2, 3.95] }, "variableName" : "Raster" }
rasterArgs = {};
rasterArgs["Colormap"] = ColorsGradient([new Color(150,255,255),new Color(255,255,150),new Color(255,150,150)]); //ColorsGradient上一篇文章所寫的函數
rasterArgs["Azimuth"] =215;
rasterArgs["Altitude"] =75;
rasterFunction.arguments=rasterArgs;
rasterFunction.functionName = "ShadedRelief";
imageLayer.renderingRule = rasterFunction; //imageLayer爲ArcGISImageServiceLayer
這樣就可以進行渲染了,但是值得我們注意的是,服務中柵格數據到底是離散型還是連續型的,上面提到的函數都針對不同的數據類型。