I have a rather specific spatial search that I need to do. Basically, you have an object (allowing calling obj1) with two locations, allows you to call them point A and point B.
Then I have a set of objects (allows you to call each of obj2), each with its own points A and B.
I want to return the top 10 objects from a collection sorted by:
(distance from obj1 A to obj2A) + (distance from obj1B to obj2B)
Any ideas? Thanks Nick
Update: Here are some more details about the documents and how I want to compare them.
Domain Model:
Listing: ListId int Title bar Price double Place of origin Destination
Location: Post / Zipcode String Decimal Point Width Decimal Longitude
What I want to do is take a list object (not in the database) and compare it with the collection of lists in the database. I want the query to return the top 12 (or x) number of lists sorted by distance from the source, plus a crow, flying from the destination.
I don’t care about the distance from the source to the destination - only about the distance from the place of origin to the destination, plus the destination to the destination.
I mainly try to find lists where the start and end locations are close.
Please let me know if I can clarify more. Thank!
source
share