ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data Namespace / QueryDescription Class / SetShapeType Method
The type of shape to be set.
Example

In This Topic
    SetShapeType Method
    In This Topic
    Sets the geometry type on the spatial column of the underlying single table or query layer if present. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Sub SetShapeType( _
       ByVal shapeType As GeometryType _
    ) 
    public void SetShapeType( 
       GeometryType shapeType
    )

    Parameters

    shapeType
    The type of shape to be set.
    Exceptions
    ExceptionDescription
    A database-related exception has occurred.
    Remarks
    Calling this method when IsSpatialQuery returns false will cause an exception.
    Example
    Create QueryDescription from a query for a Database table which has more than one shape type
    {
      await QueuedTask.Run(() =>
      {
        DatabaseConnectionProperties databaseConnectionProperties = new DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer)
        {
          AuthenticationMode = AuthenticationMode.DBMS,
          Instance = "instance",
          Database = "database",
          User = "user",
          Password = "password"
        };
    
        using (Database database = new Database(databaseConnectionProperties))
        {
          QueryDescription pointQueryDescription = database.GetQueryDescription("select Description, SHAPE, UniqueID from MULTIGEOMETRYTEST",
              "MultiGeometryPoint");
          pointQueryDescription.SetShapeType(GeometryType.Point);
          using (Table pointTable = database.OpenTable(pointQueryDescription))
          {
            //use pointTable
          }
    
          QueryDescription polygonQueryDescription = database.GetQueryDescription("select Description, SHAPE, UniqueID from MULTIGEOMETRYTEST",
              "MultiGeometryPolygon");
          polygonQueryDescription.SetShapeType(GeometryType.Polygon);
          using (Table polygonTable = database.OpenTable(polygonQueryDescription))
          {
            //use polygonTable
          }
        }
      });
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also