Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
autra opened this issue May 6, 2021 · 0 comments

Comments

@autra
Copy link

autra commented May 6, 2021

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant