cuspatial icon indicating copy to clipboard operation
cuspatial copied to clipboard

[FEA] Use cudf List types for polygon and polyline geometry

Open trxcllnt opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. With the addition of List and Struct types in cuDF, we can update cuSpatial's polygon and polyline geometry representations to use nested "list of lists of point structures".

Describe the solution you'd like The logical structure of a list of polygons looks like this:

polygons = [
    [ // <-- polygon 1
        [ // <-- ring 1
            [40, 40], [20, 45], [45, 30], [40, 40] // <-- points
        ]
    ],
    [ // <-- polygon 2
        [ // <-- ring 1
            [20, 35], [10, 30], [10, 10], [30, 5], [45, 20], [20, 35] // <-- points
        ],
        [ // <-- ring 2
            [30, 20], [20, 15], [20, 25], [30, 20] // <-- points
        ]
    ]
]

We can represent these data in the same 4 buffers we use today (poly_offsets, ring_offsets, points_x, points_y) with the following Arrow types:

import pyarrow as pa

polygons = pa.list(pa.field(
  "rings", pa.list(pa.field(
    "points", pa.struct([
      pa.field("x", pa.float32()),
      pa.field("y", pa.float32())
    ])
  ))
))

# The above example's underlying buffers:
# polygon_offsets: [0, 1, 3]
# ring_offsets: [0, 4, 10, 14]
# xs: [40, 20, 45, 40, 20, 10, 10, 30, 45, 20, 30, 20, 20, 30]
# ys: [40, 45, 30, 40, 35, 30, 10, 5, 20, 35, 20, 15, 25, 20]

Additional context https://github.com/geopandas/geo-arrow-spec/issues/3 https://github.com/geopandas/geo-arrow-spec/issues/4

trxcllnt avatar Aug 06 '20 22:08 trxcllnt

This issue has been marked rotten due to no recent activity in the past 90d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

github-actions[bot] avatar Feb 16 '21 20:02 github-actions[bot]

This issue has been marked stale due to no recent activity in the past 30d. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be marked rotten if there is no activity in the next 60d.

github-actions[bot] avatar Feb 16 '21 20:02 github-actions[bot]

This should be possible now that we have list and struct types in cuDF.

trxcllnt avatar Feb 19 '21 18:02 trxcllnt

This issue has been labeled inactive-30d due to no recent activity in the past 30 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed. This issue will be labeled inactive-90d if there is no activity in the next 60 days.

github-actions[bot] avatar Mar 21 '21 18:03 github-actions[bot]

This issue has been labeled inactive-90d due to no recent activity in the past 90 days. Please close this issue if no further response or action is needed. Otherwise, please respond with a comment indicating any updates or changes to the original issue and/or confirm this issue still needs to be addressed.

github-actions[bot] avatar Nov 23 '21 20:11 github-actions[bot]