Skip to content

Provide a way to convert back and forth between patch and multipoint geometry #284

@autra

Description

@autra

Description

It's often useful to convert between patches and multipoint geometry.

It's possible to do so already:

  • I do patch to multipoint with pc_explode and st_collect
  • I do multipoint to patch with something like
select pc_makepatch 
from source, 
     lateral st_dumppoints(geom) d, 
     lateral unnest(ARRAY[st_x(), st_y(), st_z(), some_metadata]) 

(not showing the whole picture here, just the general idea).

But some built-in function would certainly be helpful (also maybe for perf?).

Proposition

PC_ToGeometry would return a multipoint (though you would loose any other information in the point, depending on the format).

PC_GeometryToPatch would return a patch from a multipoint (or actually any geometry by taking the vertices). There could be 2 flavors:

  • PC_GeometryToPatch(geometry) -> patch
  • PC_GeometryToPatch(ROW) -> patch would also embed some metadata in the point. Maybe we would need to have the pcid as parameter too in this case.

Questions

  • For PC_ToGeometry, I'd like to have a way to get the associated metadata too, but actually I can't think of anything better than pc_explode for now. Maybe it could return a ROW with an array by metadata properties ?

Is it a feature this project would accept ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions