阅读:1324回复:3
如何创建一个层啊?
AE+VB 求教方法!
|
|
1楼#
发布于:2005-09-11 11:03
学什么!看软件帮助比较好!!!!!!!!!
|
|
2楼#
发布于:2005-08-26 11:19
<P>谢谢gis !</P>
<P>如何得到一个层中的所有feature的个数呢?</P> |
|
3楼#
发布于:2005-08-25 16:05
<P>Public Function CreateShapefile(strFolder As String, strName As String, _<BR> geomType As esriGeometryType) As esriGeoDatabase.IFeatureClass</P>
<P>'' 在目录里建立一个shp图层.<BR>'' 注意: shapefile的名字不包括 .shp 扩展名<BR>'' 作者:<BR>'' 修改时间:</P> <P> Const strShapeFieldName As String = "Shape"</P> <P> On Error GoTo EH<BR> Set CreateShapefile = Nothing<BR> If strFolder = "" Then Exit Function</P> <P> ' Open the folder to contain the shapefile as a workspace<BR> Dim pFWS As esriGeoDatabase.IFeatureWorkspace<BR> Dim pWorkspaceFactory As esriGeoDatabase.IWorkspaceFactory<BR> Set pWorkspaceFactory = New esriDataSourcesFile.ShapefileWorkspaceFactory<BR> Set pFWS = pWorkspaceFactory.OpenFromFile(strFolder, 0)</P> <P> ' Set up a simple fields collection<BR> Dim pFields As esriGeoDatabase.IFields<BR> Dim pFieldsEdit As esriGeoDatabase.IFieldsEdit<BR> Set pFields = New esriGeoDatabase.Fields<BR> Set pFieldsEdit = pFields</P> <P> Dim pField As esriGeoDatabase.IField<BR> Dim pFieldEdit As esriGeoDatabase.IFieldEdit</P> <P> ' Make the shape field<BR> ' it will need a geometry definition, with a spatial reference<BR> Set pField = New esriGeoDatabase.Field<BR> Set pFieldEdit = pField<BR> pFieldEdit.Name = strShapeFieldName<BR> pFieldEdit.Type = esriFieldTypeGeometry</P> <P> Dim pGeomDef As esriGeoDatabase.IGeometryDef<BR> Dim pGeomDefEdit As esriGeoDatabase.IGeometryDefEdit<BR> Set pGeomDef = New esriGeoDatabase.GeometryDef<BR> Set pGeomDefEdit = pGeomDef<BR> With pGeomDefEdit<BR> .GeometryType = geomType<BR> Set .SpatialReference = New esriGeometry.UnknownCoordinateSystem<BR> End With<BR> Set pFieldEdit.GeometryDef = pGeomDef<BR> pFieldsEdit.AddField pField</P> <P> ' Create the shapefile<BR> ' (some parameters apply to geodatabase options and can be defaulted as Nothing)</P> <P> Set CreateShapefile = pFWS.CreateFeatureClass(strName, pFields, Nothing, _<BR> Nothing, esriFTSimple, strShapeFieldName, "")<BR> Exit Function<BR>EH:<BR> MsgBox Err.Description, vbInformation, "createShapefile"<BR>End Function<BR></P> |
|
|