Skip to content

V2: Constructing item from geometry with tuple coords #1706

Closed as not planned

Description

@tylanderson

Constructing an item from a shapely derived mapping results in validation errors when calling item.validate()

Example:

import shapely
from pystac import Item
import datetime


geom = shapely.from_wkt("POLYGON ((-95.780872 29.517294, -95.783782 29.623358, -96.041791 29.617689, -96.038613 29.511649, -95.780872 29.517294))")
bbox = geom.bounds
geojson = shapely.geometry.mapping(geom)
item = Item(
    id="some_id",
    geometry=geojson,
    bbox=bbox,
    datetime=datetime.datetime.now(),
    properties={},
)
item.validate()

yields an error as coords are expected to validate as lists:

pystac.errors.STACValidationError: {'type': 'Polygon', 'coordinates': (((-95.780872, 29.517294), (-95.783782, 29.623358), (-96.041791, 29.617689), (-96.038613, 29.511649), (-95.780872, 29.517294)),)} is not valid under any of the given schemas...

Surfaced from testing migration to v2 using stactools as test case

Activity

  1. added this to the v2.0 milestone on Apr 22, 2026
  2. gadomski commented on Oct 5, 2026

    @gadomski
    Member

    Closing as a v2 specific issue that's OBE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions