Arcgis Engine¶þ´Î¿ª·¢ÊµÑ鱨¸æ ÏÂÔر¾ÎÄ

´´½¨¸öÈ˵ØÀíÊý¾Ý¿â´´½¨Õ¤¸ñĿ¼ÒýÈëÁ½·ù±»ÏâǶӰÏñÌí¼Ó¿Ø¼þºÍÀà¿âÔËÐУ¬¼ÓÔØÏâǶºÃµÄÓ°ÏñÌí¼ÓʼþÏìÓ¦º¯ÊýÌí¼ÓÀà³ÉÔ±º¯Êý

¹Ø¼ü´úÂ룺 1.Ìí¼ÓÀà³ÉÔ±º¯Êý

publicvoid Mosaic(stringGDBName, stringcatalogName, stringoutputFolder, stringoutputName) {

//´ò¿ª¸öÈËÊý¾Ý¿â

IWorkspaceFactoryworkspaceGDBFactory = newAccessWorkspaceFactoryClass(); IWorkspaceGDBworkspace = workspaceGDBFactory.OpenFromFile(GDBName, 0); //´ò¿ªÒª±»ÏâǶµÄÓ°ÏñËùÔÚµÄÕ¤¸ñĿ¼

IRasterWorkspaceExrasterWorkspaceEx = (IRasterWorkspaceEx)GDBworkspace; IRasterCatalograsterCatalog;

rasterCatalog = rasterWorkspaceEx.OpenRasterCatalog(catalogName); //¶¨ÒåÒ»¸öÓ°ÏñÏâǶ¶ÔÏó

IMosaicRastermosaicRaster = newMosaicRasterClass(); //ÏâǶդ¸ñĿ¼ÖеÄËùÓÐÓ°Ïñµ½Ò»¸öÊä³öÕ¤¸ñÊý¾Ý¼¯ mosaicRaster.RasterCatalog = rasterCatalog;

//ÉèÖÃÏâǶѡÏî

mosaicRaster.MosaicColormapMode = rstMosaicColormapMode.MM_MATCH; mosaicRaster.MosaicOperatorType = rstMosaicOperatorType.MT_LAST; //´ò¿ªÊä³öÕ¤¸ñÊý¾Ý¼¯ËùÔڵŤ×÷¿Õ¼ä

IWorkspaceFactoryworkspaceFactory = newRasterWorkspaceFactoryClass(); IWorkspace workspace = workspaceFactory.OpenFromFile(outputFolder, 0); //±£´æµ½Ä¿±êÕ¤¸ñÊý¾Ý¼¯£¬Êý¾Ý¸ñʽ¿ÉÒÔÊÇtiff,img,gid... ISaveAssaveas = (ISaveAs)mosaicRaster;

saveas.SaveAs(outputName, workspace, \); }

2.Ìí¼ÓʼþÏìÓ¦º¯Êý

privatevoidmiRasterMosaic_Click(object sender, EventArgs e) {

RasterUtilrastUtil = newRasterUtil();

rastUtil.Mosaic(\, \, \, \); }

3.ÔËÐнá¹û

ʵÏÖÕ¤¸ñͳ¼Æ³ÌÐò ʵÑé˼·£º

±¾ÊµÑéÊÇҪʵÏÖͳ¼ÆÈںϺóµÄMosaicRaster.tifÓ°ÏñµÄ¾ùÖµºÍ±ê×¼²î¡£ArcGIS EngineΪդ¸ñͳ¼ÆÌṩÁËÏà¹Ø×é¼þ£¬RasterStatistics×é¼þʵÏÖÁËIRasterStatistics½Ó¿Ú¡£ÊµÏÖʵÑé°üÀ¨ÒÔϼ¸¸ö²¿·Ö£º

1.Ìí¼Ó¿Ø¼þ£ºÔÚ³ÌÐòÖ÷²Ëµ¥Ïî¡°Õ¤¸ñ¹ÜÀí¡±µÄÏÂÀ­²Ëµ¥ÖÐÐÂÔö²Ëµ¥Ïî¡°Õ¤¸ñͳ¼Æ¡±

2.Ìí¼ÓÀà³ÉÔ±º¯Êý£ºÏòÕ¤¸ñ¹¤¾ßÀàÌí¼Ó¡°Õ¤¸ñͳ¼Æ¡±º¯Êý£¬Í³¼ÆÕ¤¸ñÓ°ÏñµÄ¾ùÖµºÍ±ê×¼²î¡£

3.Ìí¼ÓʼþÏìÓ¦º¯Êý£ºÎª²Ëµ¥Ïî¡°Õ¤¸ñͳ¼Æ¡±²Ëµ¥ÏîÌí¼Óµã»÷ʼþÏìÓ¦º¯Êý£¬Íê³ÉÕ¤¸ñͳ¼Æ£¬²¢½«½á¹ûÒÔ¶Ô»°¿òÐÎʽչʾ³öÀ´¡£

¹Ø¼ü´úÂ룺

1.Ìí¼ÓÕ¤¸ñͳ¼Æº¯Êý

publicstringRasterStistics(stringfilePath, stringrasterName) {

IWorkspace workspace;

IRasterWorkspacerasterWorksapce; //´ò¿ª¹¤×÷¿Õ¼ä

rasterWorksapce = OpenRasterWorkspaceFromFile(filePath); workspace = (IWorkspace)rasterWorksapce; //´ò¿ªÕ¤¸ñÊý¾Ý¼¯

IRasterDatasetrasterDataset = rasterWorksapce.OpenRasterDataset(rasterName); //µÃµ½Õ¤¸ñ²¨¶Î

IRasterBandCollectionrasterBands = (IRasterBandCollection)rasterDataset; IEnumRasterBandenumRasterBand = rasterBands.Bands; //¶¨ÒåÒ»¸ö×Ö·û´®Í³¼Æ½á¹û

stringsRasterStisticsResult = \Õ¤¸ñͳ¼Æ½á¹û:\\n\; //Öð¸ö²¨¶Îͳ¼Æ£¬Ã¿¸ö²¨¶ÎµÄ¾ùÖµºÍ±ê×¼²î

IRasterBandrasterBand = enumRasterBand.Next(); while (rasterBand != null) {

//µ÷ÓûñÈ¡Õ¤¸ñͳ¼ÆÐÅÏ¢º¯Êý boolbRes = false;

rasterBand.HasStatistics(outbRes); if (!bRes)

{

rasterBand.ComputeStatsAndHist(); }

sRasterStisticsResult += GetRasterStistics(rasterBand); rasterBand = enumRasterBand.Next(); }

returnsRasterStisticsResult; }

//¹¦ÄÜ£º¸ù¾Ý¸ø¶¨Õ¤¸ñ²¨¶Î£¬Í³¼ÆÆä¾ùÖµºÍ¾ù·½²î£¬²¢ÒÔ×Ö·û´®ÐÎʽ·µ»Ø privatestringGetRasterStistics(IRasterBandrasterBand) {

IRasterStatisticsrasterStatistics = rasterBand.Statistics; stringstatisticsResult;

statisticsResult = \¾ùֵΪ£º\ + rasterStatistics.Mean.ToString() + \±ê×¼²îΪ£º\ +rasterStatistics.StandardDeviation.ToString();

returnstatisticsResult; }

2.Ìí¼ÓʼþÏìÓ¦º¯Êý

privatevoidmiRasterstatistic_Click(object sender, EventArgs e) {

stringrasterStatistics;

RasterUtilrastUtil = newRasterUtil(); rasterStatistics =rastUtil.RasterStistics(\, \); MessageBox.Show(rasterStatistics); }

3.ÔËÐгɹû