Flyingis

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

          用多邊形裁剪影像文件

              作者:Flyingis

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

              C#

          public IGeoDataset Clip (IGeoDataset GeoDataset, IEnvelope Rectangle);


              Java

          public IGeoDataset clip(IGeoDataset geoDataset, IEnvelope rectangle);

              ArcObject代碼示例,同樣可以應(yīng)用到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"#)

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


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

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

          評論

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

          博主,你好!我最近寫一個用多邊形裁剪影像數(shù)據(jù)的程序,將多邊形選定范圍的影像圖輸出,另存為單獨的柵格文件,我用你上面的方法試了下,沒有成功,樓主能把完整的代碼發(fā)給我一份嗎?或者給我指點一下也可以,先謝謝樓主拉~~
          我qq:306407957
          E-mail:wd0360115@126.com
          2008-05-24 22:12 | SunShine
          主站蜘蛛池模板: 平泉县| 田阳县| 许昌市| 呼图壁县| 金塔县| 大余县| 郯城县| 双江| 广南县| 时尚| 黄梅县| 和政县| 灯塔市| 竹溪县| 尼玛县| 右玉县| 银川市| 丰镇市| 柘荣县| 兰溪市| 新建县| 原平市| 琼海市| 加查县| 沅陵县| 沐川县| 渑池县| 海城市| 饶阳县| 沁水县| 玉门市| 商丘市| 青冈县| 高安市| 兰州市| 区。| 卫辉市| 洞口县| 班玛县| 包头市| 江西省|