dfsh1983
路人甲
路人甲
  • 注册日期2005-08-03
  • 发帖数23
  • QQ
  • 铜币195枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1324回复:3

如何创建一个层啊?

楼主#
更多 发布于:2005-08-25 14:33
AE+VB 求教方法!
喜欢0 评分0
jss_193
路人甲
路人甲
  • 注册日期2005-07-06
  • 发帖数60
  • QQ
  • 铜币273枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-09-11 11:03
学什么!看软件帮助比较好!!!!!!!!!
举报 回复(0) 喜欢(0)     评分
dfsh1983
路人甲
路人甲
  • 注册日期2005-08-03
  • 发帖数23
  • QQ
  • 铜币195枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-08-26 11:19
<P>谢谢gis !</P>
<P>如何得到一个层中的所有feature的个数呢?</P>
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
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>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
游客

返回顶部