Abhijeet,
from the docs and implementation, there is no sorting going on here.
Instead, all of the returned points satisfy the bonuding box you are
requesting
/**
* Extracts Layer items with a distance from the given point that is
less than or equal the given distance.
*
* @param layer with latitude, longitude coordinates
* @param point
* @param maxDistanceInKm
* @return geoPipeline
*/
public static GeoPipeline startNearestNeighborLatLonSearch(Layer
layer, Coordinate point, double maxDistanceInKm) {
Envelope searchWindow =
OrthodromicDistance.suggestSearchWindow(point, maxDistanceInKm);
GeoPipeline pipeline = start(layer, new SearchIntersectWindow(layer,
searchWindow))
.calculateOrthodromicDistance(point);
if (layer.getGeometryType() == Constants.GTYPE_POINT) {
pipeline = pipeline.propertyFilter("OrthodromicDistance",
maxDistanceInKm, FilterPipe.Filter.LESS_THAN_EQUAL);
}
return pipeline;
}
/**
* Calculates the distance between Layer items nearest to the given
point and the given point.
* The search window created is based on Layer items density and it
could lead to no results.
*
* @param layer
* @param point
* @param numberOfItemsToFind tries to find this number of items
for comparison
* @return geoPipeline
*/
public static GeoPipeline startNearestNeighborSearch(Layer layer,
Coordinate point, int numberOfItemsToFind) {
Envelope searchWindow =
SpatialTopologyUtils.createEnvelopeForGeometryDensityEstimate(layer,
point, numberOfItemsToFind);
return startNearestNeighborSearch(layer, point, searchWindow);
}
For this to happen, you could either contribute a
SortingNearestNeighborSearch (that does the sorting for you) or have a
second sort step?
On Thu, Oct 25, 2012 at 12:10 PM, Abhijeet Deshpande
> --
>
>