Export true curves from a geodatabase to a shapefile

Last Published: April 25, 2020


When true curves are created in a geodatabase at a very large scale, they often come across as triangular shapes once converted to shapefile format.

Instructions provide code for converting polygon geodatabase features containing true curves to shapefile features using a method that helps maintain the shape of the true curve.


This code sample uses the DensifyByAngle method to help get around this known issue.

  1. Start ArcMap.
  2. Open the Visual Basic Editor.

    In ArcMap, select Tools > Macros > Visual Basic Editor.

  3. In the Project Explorer window, expand Project.mxt and select ArcMap Objects > ThisDocument and right-click to select View Code.
    [O-Image] Visual Basic Project  Explorer
    Code in the Project's ThisDocument code module will only run in the current map document. If you want to store the code in all your map documents open the Normal.mxt ThisDocument code module instead.

  4. Paste the following code into the code module.

    Sub ExportTrueArcs2Shapefile()

    Dim pDoc As IMxDocument
    Dim pFlayerGDB As IFeatureLayer
    Dim pFCursor As IFeatureCursor
    Dim pFeature As IFeature
    Dim pFlayerShape As IFeatureLayer
    Dim pFlayerShapeFC As IFeatureClass
    Dim pPolycurve As IPolycurve2
    Dim dPi As Double
    Dim dMaxSeg As Double
    Dim pGeometry As IGeometry
    Dim dXyUnit As Double
    Dim dXfalse As Double
    Dim dyFalse As Double
    Dim pSPRef As ISpatialReference
    Dim pSegCol As ISegmentCollection
    Dim bNonLinear As Boolean
    Dim pCurve As ICurve

    Set pDoc = ThisDocument
    Set pFlayerGDB = pDoc.FocusMap.Layer(0)
    Set pFCursor = pFlayerGDB.FeatureClass.Search(Nothing, False)
    Set pFeature = pFCursor.NextFeature

    If pFlayerGDB.FeatureClass.ShapeType <> esriGeometryPolygon _
    Then Exit Sub

    Set pFlayerShape = pDoc.FocusMap.Layer(1)
    Set pFlayerShapeFC = pFlayerShape.FeatureClass

    'Get the angle in radians
    dPi = Atn(1) * 4

    Set pGeometry = pFeature.ShapeCopy
    Set pSPRef = pGeometry.SpatialReference
    pSPRef.GetFalseOriginAndUnits dXfalse, dyFalse, dXyUnit

    dMaxSeg = (1 / dXyUnit) * 100000
    While Not pFeature Is Nothing
    Set pCurve = pFeature.Shape
    Set pPolycurve = pCurve
    Set pSegCol = pPolycurve
    pSegCol.HasNonLinearSegments bNonLinear
    If bNonLinear Then
    pPolycurve.DensifyByAngle dMaxSeg, dPi / 180
    End If
    storeFeature pPolycurve, pFlayerShapeFC
    Set pFeature = pFCursor.NextFeature
    End Sub

    Private Sub storeFeature(pGeo As IGeometry, pFClass As _
    On Error GoTo errHand
    Dim pNewFCursor As IFeatureCursor
    Dim pFeatureBuffer As IFeatureBuffer

    Set pNewFCursor = pFClass.Insert(True)
    Set pFeatureBuffer = pFClass.CreateFeatureBuffer
    Set pFeatureBuffer.Shape = pGeo
    pNewFCursor.InsertFeature pFeatureBuffer
    Exit Sub
    Debug.Print Err.Description
    End Sub

  5. Close the Visual Basic Editor.
  6. Add the polygon geodatabase feature class containing the true curves to ArcMap.
  7. Add an empty polygon or polyline shapefile to ArcMap. The features in the geodatabase feature class will be converted and loaded into the shapefile feature class.
  8. Make sure the geodatabase feature class is the first layer listed in the Table of Contents and that the shapefile is second.
  9. Run the code.

    A. Click Tools > Macros > Macros to display the Macros dialog box.
    B. Select a macro and click Run.

Article ID:000006287

  • ArcMap 8 x
  • ArcMap 9 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options