Skip to content

Create geometries with different number of points in a vectorized way #138

@TonyXiang8787

Description

@TonyXiang8787

I have found this open-source project by looking for a vectorized geospatial python library. I am impressed about how the library can handle geospatial processing with full vectorization. However, I could not figure out how to create geometries with different number of points in a vectorized way. A very simple example.

I can create two polygons in one call, if the polygons have the same number of points.

pygeos.polygons(
    [
        [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0]],
        [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0]]
    ]
)

However, if I put two polygons with different number of points, it will not work.

pygeos.polygons(
    [
        [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0]],
        [[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]
    ]
)

I will get a type error:
TypeError: One of the arguments is of incorrect type. Please provide only Geometry objects.

Is this a design choice? Or does it have to do with the limitations of ufunc in numpy? Or maybe I have not found the correct usage of this library. In that case I apologise for not being able to find the relevant information in the documentation.

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