阅读:4297回复:4
arcengine如何新建新图层
<P>用arcengine如何新建一个全新图层呢?我想这应该还涉及到图层类型,图层数据结构的确立吧.大家有知道的请指教了!</P>
|
|
1楼#
发布于:2006-11-07 11:02
谢谢gis,这个我正需要呢。<img src="images/post/smile/dvbbs/em04.gif" />
|
|
2楼#
发布于:2006-09-17 11:01
<P>谢谢!!!</P>
<P>我已经按照sample里的例子用c#实现了</P> <P>但是现在有这样一个问题,我之前做了地图编辑的功能,都是在打开mxd文件和shape文件的基础上对其进行编辑.但是现在要求全部数据存储到数据库中,用sde进行读取.那么该怎么样把图层加载到mapcontrol控件中呢?之前的地图编辑和其他功能都是对mapcontrol控件的图层进行操作的,如果用sde读取数据库的话原来的代码还能正常运行吗?</P> <P>这个问题真是严重了,希望大家指导!!!!!!</P> |
|
3楼#
发布于:2006-09-14 09:43
How to use: <BR>拷贝代码到你的 VB 或者 VBA 程序里.<BR>在你的程序里Call下面的函数.<BR>Public Sub CreateShapefile()<BR><BR> Const strFolder As String = "D:\Data"<BR> Const strName As String = "MyShapeFile" ' Dont include .shp extension<BR> Const strShapeFieldName As String = "Shape"<BR> <BR> ' Open the folder to contain the shapefile as a workspace<BR> Dim pFWS As IFeatureWorkspace<BR> Dim pWorkspaceFactory As IWorkspaceFactory<BR> Set pWorkspaceFactory = New ShapefileWorkspaceFactory<BR> Set pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0)<BR> <BR> ' Set up a simple fields collection<BR> Dim pFields As IFields<BR> Dim pFieldsEdit As IFieldsEdit<BR> Set pFields = New esriCore.Fields<BR> Set pFieldsEdit = pFields<BR> <BR> Dim pField As IField<BR> Dim pFieldEdit As IFieldEdit<BR> <BR> ' Make the shape field<BR> ' it will need a geometry definition, with a spatial reference<BR> Set pField = New esriCore.Field<BR> Set pFieldEdit = pField<BR> pFieldEdit.Name = strShapeFieldName<BR> pFieldEdit.Type = esriFieldTypeGeometry<BR> <BR> Dim pGeomDef As IGeometryDef<BR> Dim pGeomDefEdit As IGeometryDefEdit<BR> Set pGeomDef = New GeometryDef<BR> Set pGeomDefEdit = pGeomDef<BR> With pGeomDefEdit<BR> .GeometryType = esriGeometryPolygon<BR> Set .SpatialReference = New UnknownCoordinateSystem<BR> End With<BR> Set pFieldEdit.GeometryDef = pGeomDef<BR> pFieldsEdit.AddField pField<BR><BR> ' Add another miscellaneous text field<BR> Set pField = New esriCore.Field<BR> Set pFieldEdit = pField<BR> With pFieldEdit<BR> .Length = 30<BR> .Name = "MiscText"<BR> .Type = esriFieldTypeString<BR> End With<BR> pFieldsEdit.AddField pField<BR> <BR> ' Create the shapefile<BR> ' (some parameters apply to geodatabase options and can be defaulted as Nothing)<BR> Dim pFeatClass As IFeatureClass<BR> Set pFeatClass = pFWS.CreateFeatureClass(strName, pFields, Nothing, _<BR> Nothing, esriFTSimple, strShapeFieldName, "")<BR>End Sub<BR>
|
|
|
4楼#
发布于:2006-09-14 09:14
<P>CreateFeatureClass Method (esriGeoDatabase)</P>
<P><br>Example <br> </P> <P>Creates a new standalone feature class under the workspace. </P> <P>Syntax</P> <P>Set variable = object.CreateFeatureClass (Name, Fields, CLSID, EXTCLSID, FeatureType, ShapeFieldName, ConfigKeyword )</P> <P>The CreateFeatureClass method syntax has the following object qualifier and arguments:</P> <P>Part Description <br>object An object expression that evaluates to an object in the Applies To list. <br>variable A reference to an object that implements IFeatureClass. <br>Name Required. A string expression that represents the Name. <br>Fields Required. An IFields object. <br>CLSID Required. An IUID object. <br>EXTCLSID Required. An IUID object. <br>FeatureType Required. An esriFeatureType constant whose value represents the FeatureType. <br>ShapeFieldName Required. A string expression that represents the ShapeFieldName. <br>ConfigKeyword Required. A string expression that represents the ConfigKeyword. <br></P> |
|
|