[GIS] Spatial join between point files using FME

fme

I have two files: the first has x,y,z information and is a (big) point cloud file, and second has only x,y information and is a (small) point shp file. The two files occupy the same area.

For each of the x,y points in the shp file, I would like to find the nearest x,y point in the point cloud file and pass the corresponding point cloud z value to the attribute table of the shp file. I would also like to avoid converting the point cloud to any other format (due to file sizes)

I am fairly new to FME and I'm not sure what is the right tool for the job. After some research, I tried the SpatialRelator but this seems to be the wrong tool (at least by itself) because it does not seem to support a "near" (within a certain distance) calculation. Maybe I'm too used to ArcGIS, but FME does not seem to have a "spatial join" type tool, or at least they are calling it something else…

Best Answer

I don't think the NeighborFinder will work with the raw data because it treats the point cloud as an entire feature, so it only locates the centre point regardless. It seems that you will have to convert the point cloud geometry to something else.

As @alexgleith said, you could convert it to a surface and use draping. I would suggest using the PointCloudCoercer transformer to convert it to a set of point (or multi-point) features. Use a CoordinateExtractor to fetch the Z value for each and a 2DForcer to flatten the data.

Then you could use the NeighborFinder to get what you need.

Amendment: Having thought about it, there is a quicker method.

Create a buffer around your point feature using the Bufferer transformer. Set it to 100m (for example) in the same way you would for the NeighborFinder. Now use this buffer to clip the Point Cloud with the Clipper transformer.

What this will do is drastically reduce the amount of point cloud you are working with. From potentially billions of points you could be down to just a handful. Then using the above PointCloudCoercer/CoordinateExtractor/NeighborFinder method on the output from the Clipper should produce a result way, way, way, quicker.

I created an example...

enter image description here

...and placed the fmw file at: https://dl.dropboxusercontent.com/u/4200566/Community/PointCloudNearestNeighbor.fmw