Flyingis

          Talking and thinking freely !
          Flying in the world of GIS !
          隨筆 - 156, 文章 - 16, 評論 - 589, 引用 - 0
          數據加載中……

          用多邊形裁剪影像文件

              作者:Flyingis

              多邊形裁剪影像文件最簡單的情況,是使用矩形進行裁剪,在ArcEngine中ITransformationOp.Clip方法可以直接完成。

              C#

          public IGeoDataset Clip (IGeoDataset GeoDataset, IEnvelope Rectangle);


              Java

          public IGeoDataset clip(IGeoDataset geoDataset, IEnvelope rectangle);

              ArcObject代碼示例,同樣可以應用到ArcEngine:
          ' Create the RasterTransformationOp object
          Dim pTransformationOp As ITransformationOp
          Set pTransformationOp = New RasterTransformationOp

          ' Get raster
          Dim pRas01 As IRaster
          Set pRas01 = getRasterFromDiskFunction("c:datamyRaster")

          ' Declare an envelope object
          Dim pEnvelope As IEnvelope

          ' Create an envelope
          Set pEnvelope = New Envelope
          pEnvelope.PutCoords 
          1133

          ' Declare the output raster object
          Dim pGeoDS As IGeoDataset

          ' Calls the method
          Set pGeoDS = pTransformationOp.Clip(pRas01, pEnvelope)

              如果使用ArcEngine92,可以用Geoprocessing來處理,利用Data Management Tools-->Raster-->Clip工具來完成,python腳本參考如下代碼:
          # Create the geoprocessing object
          import arcgisscripting
          gp 
          = arcgisscripting.create()

          gp.workspace 
          = "c:/seattle_data"
          gp.Clip_management(
          "seattle1.tif""549790.051000 5272863.993000 549870.051000 5273000.993000","seattle_clip.img"#)

              以上是最簡單的情況,更多的,我們需要用不規則多邊形polygon來進行裁剪,這時就要用到ExtractByPolygon Class,看看C#對ExtractByPolygon的屬性的描述


              最基本的,寫好in_raster、out_raster和polygon屬性即可。

          posted on 2007-04-12 11:23 Flyingis 閱讀(4879) 評論(1)  編輯  收藏 所屬分類: ArcEngine

          評論

          # re: 用多邊形裁剪影像文件[未登錄]  回復  更多評論   

          博主,你好!我最近寫一個用多邊形裁剪影像數據的程序,將多邊形選定范圍的影像圖輸出,另存為單獨的柵格文件,我用你上面的方法試了下,沒有成功,樓主能把完整的代碼發給我一份嗎?或者給我指點一下也可以,先謝謝樓主拉~~
          我qq:306407957
          E-mail:wd0360115@126.com
          2008-05-24 22:12 | SunShine
          主站蜘蛛池模板: 大方县| 井陉县| 钟祥市| 双柏县| 克拉玛依市| 万山特区| 临沧市| 滨州市| 东丽区| 县级市| 岢岚县| 夏邑县| 揭阳市| 大城县| 土默特右旗| 黔江区| 冷水江市| 翼城县| 格尔木市| 宽城| 手游| 乐都县| 琼中| 高陵县| 肃宁县| 阿拉尔市| 英吉沙县| 荔波县| 南乐县| 新津县| 胶州市| 军事| 米林县| 建水县| 泾阳县| 玛纳斯县| 郎溪县| 德江县| 航空| 贵溪市| 奎屯市|