just00
路人甲
路人甲
  • 注册日期2006-09-04
  • 发帖数9
  • QQ
  • 铜币157枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1334回复:1

新建 导出 shape 文件

楼主#
更多 发布于:2008-11-04 18:06
<P>请教一个问题:</P>
<P>新建shape文件,往里面写数据,并保存。</P>
<P> private IFeatureClass CreateFeatclass()<BR>        {<BR>            IFields pFields = new FieldsClass();<BR>            IFieldsEdit pFieldsEdit =  pFields as IFieldsEdit;<BR>            IGeometryDef pGeomDef = new GeometryDef();<BR>            IGeometryDefEdit pGeomDefEdit = pGeomDef as IGeometryDefEdit;<BR>            pGeomDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline;<BR>            pGeomDefEdit.HasM_2 = true;<BR>            pGeomDefEdit.HasZ_2 = true;</P>
<P>            IField pField = new FieldClass();<BR>            IFieldEdit pFieldEdit = pField as IFieldEdit;<BR>            pFieldEdit.Name_2 = "shape";<BR>            pFieldEdit.Type_2 = esriFieldType.esriFieldTypeGeometry;<BR>            pFieldEdit.GeometryDef_2 = pGeomDef;<BR>            pFieldsEdit.AddField(pField);</P>
<P>            return m_pFWs.CreateFeatureClass(m_newShapeName, pFields, null, null, esriFeatureType.esriFTSimple, "shape", "");<BR>        }</P>
<P>。。</P>
<P>   IWorkspaceEdit pWsEdit = m_pFWs as IWorkspaceEdit;<BR>             IFeatureClass pNewShapeFC = m_pFWs.OpenFeatureClass(m_newShapeName);</P>
<P>pWsEdit.StartEditOperation();</P>

<P>   IFeature pNewFeature = pNewShapeFC.CreateFeature();<BR>                pNewFeature.Shape = pNewPlyline;<BR>                pNewFeature.Store();                </P>
<P>。。</P>
<P>大体代码如上,.CreateFeature() 的时候报错,请高手指点。</P>
<P>谢谢<BR></P>
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2008-11-08 14:02
<P>出现什么错误?</P>
<P>请贴出错误提示</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部