Skip to content

Pipeline from scala-constructed pointcloud #22

Description

@kervel

Hello,

i couldn't find documentation so far. My problem is that i have a dataset that can be converted to a pointcloud. I do the conversion as follows:

  def toPointCloud(sweeps: Seq[Tuple3[Coordinate, Double, Seq[XZ]]]): PointCloud = {
    // the Double in the tuple3 is the azimuth.
    val points = sweeps.map(gs => projectSweep(gs._3, gs._2, gs._1)).
          reduce((a,b) => DenseMatrix.horzcat(a,b))
    var v = new util.HashMap[String, SizedDimType]()
    v += "X" -> SizedDimType(DimType.X, java.lang.Double.BYTES, 0)
    v += "Y" -> SizedDimType(DimType.Y, java.lang.Double.BYTES, java.lang.Double.BYTES)
    v += "Z" -> SizedDimType(DimType.Z, java.lang.Double.BYTES, 2*java.lang.Double.BYTES)
    val bos = ByteBuffer.allocate(points.cols * points.rows * java.lang.Double.BYTES).order(ByteOrder.nativeOrder());
    val ios = bos.asDoubleBuffer();
    ios.put(points.copy.data)
    return new PointCloud(bos.array(), v)
  }

i verified and the pointcloud seems to be okay (i can get points out of it). I'd like to create a PDAL pipeline now using this pointcloud so that i can reproject/persist/... it.

Is there a way to do this ?

greetings,
Frank

Activity

  1. pomadchin commented on Oct 25, 2019

    @pomadchin
    Collaborator

    Hey @kervel, so what is your question? How to use PDAL Pipeline, or how to transform points already loaded into memory?

    If the first question, than you can do the following:

    val pc: PipelineConstructor = LasRead("/path/to/las") ~ CropFilter() ~ SmthElse() ~ LasWrite("/path/to/new/las")
    val pipeline = pc.toPipeline
    pipeline.execute()
    pipeline.getMetadata() // gets some metadata
    val pvi = pipeline.getPointViews() // these are PDAL PointViews, views to get the actual pointclouds
    val pc = pv.getPointCloud(0, Array(DimType.X, DimType.Y)) // this one will create a PointCloud object with the point 0 and x & y dims
    pipeline.dispose()

    In the example above we'll push the Pipeline to PDAL, it would process it, and return already transformed points.

    If you want to do smth else with your pointclouds I would be happy to help you to start with https://github.com/geotrellis/geotrellis-pointcloud which exposes PDAL capabilities on Spark.

  2. pomadchin commented on Oct 25, 2019

    @pomadchin
    Collaborator

    Ah, or you want to create a pointcloud object and to return back to PDAL to process it?

  3. kervel commented on Oct 25, 2019

    @kervel
    Author

    yes. i was hoping to use pdal to rasterize a pointcloud that i constructed using spark scala code (i have seen TinToDem also in geotrellis but for that i wouldn't even have to construct a pointcloud).
    all the existing pdal examples start by loading an existing pointcloud from disk, and hence never face this problem...

  4. pomadchin commented on Oct 25, 2019

    @pomadchin
    Collaborator

    yea, so PDAL Pipeline interface only allows to perform transformations on read. So it is a sort of an IO interface in this case that allows to do transofmrations with pointclouds right after reading them from file.

    PDAL does not expose an interface to provide some pointclouds represented as some in memory buffer as an input for PDAL Pipeline.

    For your purposes for sure it is better to use TinToDem from geotrellis-pointcloud, it uses a nice delaunay triangulation implementation to perform it, so it may work.

    I'm happy to help you with it! (if you would decide to touch geotrellis-pointcloud)

  5. abellgithub commented on Oct 26, 2019

    @abellgithub
  6. pomadchin commented on Oct 26, 2019

    @pomadchin
    Collaborator

    Nice! Thanks for the pointer @abellgithub, I need to look into it.

  7. pomadchin commented on Oct 28, 2019

    @pomadchin
    Collaborator

    This probably would be done in terms of a 2.0 release.

  8. added this to the future milestone on Feb 29, 2020
  9. changed the title [-]pipeline from scala-constructed pointcloud[/-] [+]Pipeline from scala-constructed pointcloud[/+] on Mar 3, 2020
  10. added and removed
    enhancementNew feature or request
    on Aug 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions