nearneighbor distance


Would there be a way to have the distance of the participating point(s) (at least the nearest) to the node of the cell in nearneighbor interpolation ?

Thanks for answer.
French IHO

Is it what you’re looking for ? ?

Is-it possible (what is the option) to have the distance to the node of the participating point(s) in an output file ?

Not that I know of. The gmtblock* modules would be one place where that could be done.

I guess you could realise it with two steps ?

  1. Identify near neighbours with nearneighbor or block*
  2. Compute the distance between points with sphdistance.

I’ve never used it so I’m not sure how it works, but here’s an example :

… Might be worth to explore.

I have some ideas of how to divert the gmtblock * to do it but it seems complicated …

  1. assign an identifier to each point
  2. search (by dichotomy?) Until you have only one point in the search radius
  3. get the identify of the point and then there coordinates and calculate the distance

Is there another easier way? (my data sets are large)

Since you are SHOM I guess that means multi-beam bathymetry. I think the best solution would be to extend blockmedian to do it. You or any of colleagues with C knowledge would be willing to tackle that?

EDIT: or perhaps even simpler, add an option to nearneighbor to output a grid of those distances.

Maybe you can adapt this code :