中国地图
GIS探索者
地图网
GIS论坛
网站首页| GIS论坛 |新闻动态 | 技术专栏 | GIS书籍 | 资源下载 | 求职招聘 | 研究生考试 | GIS博客 | GIS空间站
欢迎光临GIS空间站!   网站地图
  专栏导航:| ArcGIS | MapInfo | TopMap | 地理信息 | 遥感 | GPS | 测绘 | WebGIS | LBS | 前沿 | 数据库 | 开发 | 行业应用
  推荐栏目:| AO开发 | 业界动态 | GIS资源 | 招聘信息 | 求职简历 | 共享软件 | 电子书籍 | 研究生考题 | 电子期刊 | GIS论文
您现在的位置: GIS空间站 >> 技术专栏 >> ArcGIS >> AO开发 >> 文章正文

ArcObjects:创建shp要素类

作者:峰哥    文章来源:SINA博客    点击数:    更新时间:2007-10-23
下面创建一个shp要素类,其他工作空间类似

Dim pWS As IWorkspace
        Dim pWSF As IWorkspaceFactory
        pWSF = New ShapefileWorkspaceFactory
        pWS = pWSF.OpenFromFile("C:\Program Files\ESRI\MapObjects2\Samples\Data\Mexico", 0)

        Dim pFields As IFields
        pFields = New Fields

        Dim pFieldsEdit As IFieldsEdit
        pFieldsEdit = pFields
        pFieldsEdit.FieldCount_2 = 3

        Dim pFE As IFieldEdit
        Dim pF As IField
        pF = New Field
        pFE = pF
        With pFE
            .Name_2 = "ObjectID"
            .AliasName_2 = "FID"
            .Type_2 = esriFieldType.esriFieldTypeOID
        End With
        pFieldsEdit.Field_2(0) = pF

        pF = New Field
        pFE = pF
        With pFE
            .Name_2 = "NAME"
            .AliasName_2 = "Name"
            .Type_2 = esriFieldType.esriFieldTypeString
        End With
        pFieldsEdit.Field_2(1) = pF

        Dim pGeoDef As IGeometryDef
        pGeoDef = New GeometryDef
        Dim pGeoDefEdit As IGeometryDefEdit
        pGeoDefEdit = pGeoDef
        Dim pSR As ISpatialReference

        Dim pFeatLyr As IFeatureLayer
        pFeatLyr = New FeatureLayer

        Dim pMap As IMap
        pMap = AxMapControl1.Map
      
        pSR = pMap.SpatialReference

        pGeoDefEdit.SpatialReference_2 = pSR
        pGeoDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPoint

        pF = New Field
        pFE = pF
        With pFE
            .Name_2 = "Shape"
            .AliasName_2 = "shape"
            .Type_2 = esriFieldType.esriFieldTypeGeometry
            .GeometryDef_2 = pGeoDefEdit
        End With
        pFieldsEdit.Field_2(2) = pF

        Dim pFeatWS As IFeatureWorkspace
        pFeatWS = pWS
        pFeatWS.CreateFeatureClass("china", pFields, Nothing, Nothing, esriFeatureType.esriFTSimple, "Shape", "")
        AxMapControl1.Refresh()

文章录入:3S_Studio    责任编辑:gissky  发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
■■相 关 图 书:
■■相 关 文 章:
没有相关文章
  • 上一篇文章:

  • 下一篇文章:
  •  
    GIS博客精华
    TopMap下载
    热点文章
    热门资源
     
    关于我们 | 联系我们 | 广告服务 | 友情链接 | 申请链接 | 合作联盟 | 诚聘英才
      GIS空间站(GISSky.Net)版权所有 站长:兔八哥