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 閱讀(4894) 評論(1)  編輯  收藏 所屬分類: ArcEngine

          評論

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

          博主,你好!我最近寫一個用多邊形裁剪影像數(shù)據(jù)的程序,將多邊形選定范圍的影像圖輸出,另存為單獨的柵格文件,我用你上面的方法試了下,沒有成功,樓主能把完整的代碼發(fā)給我一份嗎?或者給我指點一下也可以,先謝謝樓主拉~~
          我qq:306407957
          E-mail:wd0360115@126.com
          2008-05-24 22:12 | SunShine
          主站蜘蛛池模板: 彰化县| 肥东县| 钦州市| 天镇县| 大同市| 三门峡市| 明水县| 孟津县| 河北区| 万盛区| 罗山县| 若羌县| 东丰县| 山西省| 渝北区| 浦县| 堆龙德庆县| 石景山区| 桐乡市| 鞍山市| 赤城县| 长子县| 阿图什市| 金湖县| 南木林县| 沙田区| 获嘉县| 孝感市| 大田县| 集安市| 水富县| 建昌县| 丰都县| 井冈山市| 呼玛县| 商丘市| 台南县| 淮安市| 柘城县| 定日县| 武清区|