I used vtkDelaunay2d to generate a terrain surface. I wanted to obtain the elevation at two locations following this example suggested from an earlier posting. The locations are coordinates in terrain units. I have written the following code:

Almost there !
As per documentation the vtkProbeFilter computes point attributes (e.g., scalars, vectors, etc.) at specified point positions. So the coordinates of a,b are expected to remain the same but their attibutes will be filled by the filter. To get the z value try

I am still unable to get some results. It appears that I am not getting any scalar back (I used print(z_probe) to see what I got back. I am not certain why I am getting this result given that I know that the Delaunay Tessellation computed correctly (I was able to see it) and the locations that I used are within this tesselation!
I am going over everything to see what is missing!!!??

Without more code I cannot figure out what it could be the issue. Here is a full python example I created based on the VTK example and your test case. I hope it helps:

# based on https://kitware.github.io/vtk-examples/site/Cxx/PolyData/InterpolateMeshOnGrid/
import vtk
# Create a random set of 100 points in the xy-plane in (0,10)x(0,10).
# If you had instead started with a set of (x,y,z) points, you must copy
# the zvalues into a FloatArray and set it as the data set's scalars,
# and then set the z-coordinates to zero
randomPoints = vtk.vtkPoints()
zvalues = vtk.vtkFloatArray()
zvalues.SetName("ZValues")
gridSize = 10
maxHeight = 1.0
randomSequence = vtk.vtkMinimalStandardRandomSequence()
randomSequence.SetSeed(8775070)
for i in range(100):
x = randomSequence.GetRangeValue(0, gridSize)
randomSequence.Next()
y = randomSequence.GetRangeValue(0, gridSize)
randomSequence.Next();
z = randomSequence.GetRangeValue(0, maxHeight)
randomSequence.Next();
randomPoints.InsertNextPoint(x, y, 0)
zvalues.InsertNextValue(z)
randomPolyData = vtk.vtkPolyData()
randomPolyData.SetPoints(randomPoints);
randomPolyData.GetPointData().SetScalars(zvalues);
# Triangulate the grid points. If you do not have a mesh (points
# only), the output will not be interpolated!
randomDelaunay = vtk.vtkDelaunay2D()
randomDelaunay.SetInputData(randomPolyData);
randomDelaunay.Update();
# location
a = (5,5,0)
b = (4,5,0)
viewpts = vtk.vtkPoints()
viewpts.InsertNextPoint(*a)
viewpts.InsertNextPoint(*b)
data = vtk.vtkPolyData()
data.SetPoints(viewpts)
# interpolate
z_probe = vtk.vtkProbeFilter()
z_probe.SetSourceConnection(randomDelaunay.GetOutputPort())
z_probe.SetInputData(data)
z_probe.Update()
print(z_probe.GetOutput().GetPointData().GetScalars().GetTuple1(0))
print(z_probe.GetOutput().GetPointData().GetScalars().GetTuple1(1))
## or
print(z_probe.GetOutput().GetPointData().GetArray("ZValues").GetTuple1(0))
print(z_probe.GetOutput().GetPointData().GetArray("ZValues").GetTuple1(1))

I adapted your code and I did get results. Frankly, I am still a bit confused as to the logic (the bit where I cannot follow the logic is having to leave out z values when creating randompoints and having to set the scalars separately). Butâ€¦ it does work so I will endeavor to try to make sense of why.

(the bit where I cannot follow the logic is having to leave out z values when creating randompoints and having to set the scalars separately)

Delaunay2D can only work on 2D points. So we only pass x and y. We treat z as an attribute of the points which we want to interpolate( if z is confusing think of it as temperature/density or any other scalar value).

sets z as a point attribute. randomDelaunay will then triangulate the points leaving the zvalues untouched. (We could even have appended the zvalues after running the filter)

Finally, vtkProbeFilter requires a geometric object with cells as source where we can use to locate the InputData and interpolate the zvalues onto the points of InputData.