Skip to content

Polygon

Polygon represents closed shapes located on the drawing. It contains the ordered vertex coordinates as integer pairs, together with the coordinate space (pixel space or world space) they are expressed in, so you can reconstruct the outline faithfully. Polygons are used for redaction zones and for locating extracted elements on the sheet. By storing them in a consistent format, the API enables spatial analysis like area calculations, overlap detection, or highlighting regions in visualization tools. You can also overlay polygons on the original raster image to build review interfaces that connect structured results back to the drawing.

Bases: BaseModel

Represents a polygon area in the drawing.

PARAMETER DESCRIPTION
coordinate_space

The coordinate space used to define the polygon, such as absolute or relative.

TYPE: CoordinateSpace

coordinates

A list of x,y tuples representing the vertices of the polygon.

TYPE: list[tuple[int, int]]

Source code in werk24/models/v2/models.py
class Polygon(BaseModel):
    """
    Represents a polygon area in the drawing.
    """

    coordinate_space: CoordinateSpace = Field(
        ...,
        description="The coordinate space used to define the polygon, such as absolute or relative.",
    )
    coordinates: list[tuple[int, int]] = Field(
        ...,
        description="A list of x,y tuples representing the vertices of the polygon.",
    )