Skip to content

Reading SRID info from serialized geometries using shapely.get_srid is wrong for srid >= 3968 #2122

Closed

Description

@petern48
df = spark.sql("""
SELECT
    ST_SetSRID(ST_GeomFromText('POINT (0 0)'), 3857) as geom1,
    ST_SetSRID(ST_GeomFromText('POINT (0 0)'), 3967) as geom2,
    ST_SetSRID(ST_GeomFromText('POINT (0 0)'), 3968) as geom3,
    ST_SetSRID(ST_GeomFromText('POINT (0 0)'), 3969) as geom4
""")
col = df.collect()[0]
print(shapely.get_srid(col[0]))  # 3857 (correct)
print(shapely.get_srid(col[1]))  # 3967 (correct)
print(shapely.get_srid(col[2]))  # -128 (should be 3968)
print(shapely.get_srid(col[3]))  # -127 (should be 3969)

The boundary is 3968, which is 10000000. It's being interpreted as -128 instead. Seems like it's being interpreted as a signed 8-bit int instead of an unsigned one or a larger int.

Activity

  1. added a commit that references this issue on Jul 19, 2025
  2. added a commit that references this issue on Jan 21, 2026
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions