<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Flyingis

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

    Geoprocessing 數據批處理

        作者:Flyingis

        ArcGIS使用者經常要面對大量的數據處理工作,如果要在自己的程序中使用Geoprocessing,更多的時候我們是要進行對數據進行批處理分析,Geoprocessing為我們提供了豐富的支持批處理的功能。

    1.工作空間中查詢所需數據

    2.模型處理過程中各種輸入數據的處理

    3.枚舉、循環執行

    --------------------

    1.工作空間中查詢所需數據

        要對數據進行批處理操作,首先需要知道工作空間中有哪些數據,怎么從工作空間大量數據中提取出我們所需要的數據。GeoProcessor類為我們提供了一些提取數據的方法。

    listDatasets (string wildCard, string datasetType)
    listFeatureClasses (string wildCard, string featureType, string dataset)
    listRasters (string wildCard, string rasterType)
    listTables (string wildCard, string tableType)
    listToolboxes(string wildCard)
    listWorkspaces (string wildCard, string workspaceType)

        看看代碼段怎么寫:

    //list all the featureClasses starting with c
    gp.setEnvironmentValue("workspace", inputWorkspace);
    IGpEnumList featureClasses 
    = gp.listFeatureClasses("c*""""");
    String featureClass 
    = featureClasses.next();
    System.out.println(
    "-----------Feature Classes starting with c-----------");
    while (! "".equals(featureClass)) {
         System.out.println(featureClass);
         featureClass 
    = featureClasses.next();
    }

        通過指定wildCard字符串,搜索所有"c"開頭的feature class,將結果存放在com.esri.arcgis.geoprocessing.IGpEnumList枚舉List中。看到IGpEnumList千萬不要將它和Java數據結構中各種List相提并論,它僅僅具有順序枚舉next和重置查詢指針reset的功能,可以被序列化。

        再參考另外兩個例子,相信對在工作空間中查詢數據會有更多的認識。

        返回所有面狀要素

    System.out.println("\n-----------Polygon Feature Classes-----------");
    gp.setEnvironmentValue(
    "workspace", inputWorkspace);
    featureClasses 
    = gp.listFeatureClasses("""polygon""");
    featureClass 
    = featureClasses.next();
        
    while (! "".equals(featureClass)) {            
        System.out.println(featureClass);
        featureClass 
    = featureClasses.next();
    }

        返回所有TIF格式的Raster數據

    // List all TIF files in the workspace and build pyramids
    gp.setEnvironmentValue("workspace", inputWorkspace);
    IGpEnumList rasters 
    = gp.listRasters("""TIF");
    String raster 
    = rasters.next();
                      
    BuildPyramids buildPyramids 
    = new BuildPyramids(raster);
    while (! "".equals(raster)) {
        System.out.println(
    "\n------------Building pyramids for: " + raster + "----------");
        gp.execute(buildPyramids, 
    null);
        raster 
    = rasters.next();
    }

        關于各種list方法TYPE類型,可以參考下表

    Method Type Keywords
    ListDatasets All, Feature, Coverage, RasterCatalog, CAD, VPF, TIN, Topology
    ListFeatureClasses All, Point, Label, Node, Line, Arc, Route, Polygon, Region
    ListFields All, SmallInteger, Integer, Single, Double, String, Date, OID, Geometry, Blob
    ListWorkspaces All, Coverage, Access, SDE, Folder
    ListTables All, dBASE, INFO
    ListRasters  All, ADRG, BIL, BIP, BSQ, BMP, CADRG, CIB, ERS, GIF, GIS, GRID, STACK, IMG, JPEG, LAN, SID, SDE, TIF, RAW, PNG, NITF


    2.模型處理過程中各種輸入數據的處理

        Geoprocessing計算過程中會要求多個輸入,通常可以用IGpEnumList來捕獲。

    gp.setEnvironmentValue("workspace", multiWorkspace);
    IGpEnumList polygonFCs 
    = gp.listFeatureClasses("""polygon""");
    String polygon 
    = polygonFCs.next();
    String polygonsToUnion 
    = "";
    while (! "".equals(polygon)){
     polygonsToUnion 
    += polygon;
     polygon 
    = polygonFCs.next();
     
    if (! "".equals(polygon)){
      polygonsToUnion 
    += ";";
     }

    }

        
    Union union 
    = new Union(polygonsToUnion,outputWorkspace+"/unioned.shp");
    gp.execute(union, 
    null);

        另外,可以使用表結構來保存每個輸入的參數值,避免全部feature保存在一個字符串中。

    // List all feature classes in the workspace.
    gp.setEnvironmentValue("workspace", multiWorkspace);
    IGpEnumList polygonFCs 
    = gp.listFeatureClasses("""polygon""");
       
    //make the value table
    GPValueTable gpValueTable = new GPValueTable();
      
    String polygon 
    = polygonFCs.next();
    String row 
    = null;
    while (! "".equals(polygon)){
     
    if ("center".equals(polygon)){     
         row 
    = polygon + " 1";     
     }
     else {
         row 
    = polygon + " 2";
     }
          
     gpValueTable.addRow(row);
     polygon 
    = polygonFCs.next();
     }

          
    Union union 
    = new Union(gpValueTable, outputWorkspace+"/unionedValueTable.shp");
    gp.execute(union, 
    null);

    3.枚舉、循環執行

        前面兩點都是針對一個Geoprocessing操作而言,如果需要多個操作,可以用基本程序語言來描述,這分為兩種情況,一是多種Geoprocessing的數據處理,一種是同一Geoprocessing循環執行,相比ArcToolbox而言,這里體現的是程序代碼帶給我們的方便。

    posted on 2007-04-05 15:07 Flyingis 閱讀(4505) 評論(2)  編輯  收藏 所屬分類: ArcEngine

    評論

    # re: Geoprocessing 數據批處理  回復  更多評論   

    你好,我是河南理工大學畢業的,專業為GIS,我最近在學習geoprocessing,但在寫批處理時遇到了一些問題,想向你請教,還請多幫忙 ,如果方便的話,我的聯系方式是hn2359@126.com
    2007-12-26 23:09 | 賀秋華

    # re: Geoprocessing 數據批處理  回復  更多評論   

    不好意思,上面郵箱少了一個字符,應該為 hn23559@126.com
    2007-12-26 23:10 | 賀秋華
    主站蜘蛛池模板: 可以免费观看的一级毛片| 成人五级毛片免费播放| 国产a v无码专区亚洲av| 亚洲AV永久无码精品放毛片| 国产成人无码免费看视频软件| 97亚洲熟妇自偷自拍另类图片| 免费一级毛片无毒不卡| 亚洲高清专区日韩精品| 国产免费阿v精品视频网址| 亚洲精品中文字幕乱码三区| 一个人看www免费高清字幕| 国产亚洲情侣一区二区无码AV| 91成人免费福利网站在线| 亚洲人成色7777在线观看| 久久久精品免费视频| 久久精品国产亚洲AV高清热| 国产精彩免费视频| 亚洲偷自拍另类图片二区| 国产美女无遮挡免费视频网站| 日韩电影免费在线观看网址| 亚洲国产精品日韩| 玖玖在线免费视频| 亚洲精品免费在线| 成人片黄网站色大片免费| 看成年女人免费午夜视频| 亚洲无码视频在线| 性xxxx视频免费播放直播| 亚洲熟妇无码爱v在线观看| 大学生高清一级毛片免费| 免费看美女午夜大片| 亚洲国产精品va在线播放| 国产91免费视频| 免费无毒a网站在线观看| 亚洲成Av人片乱码色午夜| 久久国产免费福利永久| 色屁屁在线观看视频免费| 国产AV无码专区亚洲A∨毛片| 久久久久免费看黄A片APP| 一级做a免费视频观看网站| 亚洲综合久久综合激情久久| 精品无码国产污污污免费|