| |
set pGeomDef = New GeometryDef
Set pGeomDefEdit = pGeomDef
With pGeomDefEdit
.GeometryType = esriGeometryPolygon ' sets geometry type (currently polygon)
Set pSpatRef = pMap.SpatialReference
If (pSpatRef Is Nothing) Then ' if current map has no spatial ref
Set .SpatialReference = New UnknownCoordinateSystem ' assign null reff
Else
Set .SpatialReference = pMap.SpatialReference ' else use maps spatial ref
End If
End With
Set pFieldEdit.GeometryDef = pGeomDef
pFieldsEdit.AddField pField2
Next intCountfield
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Create the shapefile
' (some parameters apply to geodatabase options and can be defaulted as Nothing)
Dim pFeatClass As IFeatureClass
Set pFeatClass = pFeatureWorkspace.CreateFeatureClass(strNameNewPolygone, pFields, Nothing, Nothing, esriFTSimple, strShapeFieldName, "")
' Add to current map
Set pFeatureLayer = New FeatureLayer
Set pFeatureLayer.FeatureClass = pFeatClass
pFeatureLayer.Name = pFeatureLayer.FeatureClass.AliasName
pMap.AddLayer pFeatureLayer |