As @Vince notes in a comment:
Your query asks for the distance between a point and itself, so zero
is the correct answer. If you want to compare each point with the
other points you need to nest the ...
I know it has been two years, but there are three things:
You have to load raster data after retrieving a band
The below will select a user defined number of level 1 and level 2 records at random from the dataset, just update the num_level1 and num_level2 variables. I have commented the code for ease of use. ...