ArcGIS Pro 3.3 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 void SetShapeType( 
       GeometryType shapeType
    )
    Public Sub SetShapeType( _
       ByVal shapeType As GeometryType _
    ) 

    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
    public async Task MultiGeometryQueryDescription()
    {
      await ArcGIS.Desktop.Framework.Threading.Tasks.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, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also