Skip to content

Ability to set SRID in to_wkb/wkt function #137

@jorisvandenbossche

Description

@jorisvandenbossche

Assume you want to write EWKB/EWKT that includes SRID information (eg for inserting into Postgis). This is currently already supported, as you can do:

geoms = pygeos.points(...)
geoms_with_srid = pygeos.set_srid(geoms, 4326)
pygeos.to_wkb(geoms_with_srid, include_srid=True)

However, the above means you need to create a full copy of the array of geometries, just for getting the EWKB (assuming you don't need to set the SRID for anything else), which can be wasteful when working with a large array of geometries.
In principle, we could also clone and set the srid on the fly within the to_wkb ufunc. This does not avoid the cloning of all geometries, but avoids keeping those clones alive for the full array, which should improve memory usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestto-shapelyThis issue needs to be transferred to shapely

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions