|
阅读:1332回复:1
新建 导出 shape 文件
<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> |
|
|
1楼#
发布于:2008-11-08 14:02
<P>出现什么错误?</P>
<P>请贴出错误提示</P> |
|
|