On Sep 9, 5:32 pm, Mike Williams <[email protected]> wrote:
> 1. Bill Chadwick has an extension that will calculate the distance of a
> point from a polyline at the bottom of this page:
>
> http://www.bdcc.co.uk/Gmaps/BdccGmapBits.htm
>
> 2. Build a list of distances from your search result to all other
> markers, using GLatLng.distanceFrom. .sort() that list, then read the
> first few items from the sorted list.
>
> [If you're an old-school programmer, like me, you might be a little
> afraid of performing sorts in a script language. I remember writing
> Bubble Sort algorithms in BASIC that took hours to sort modest numbers
> of elements. But the Array.sort() call turns out to be blindingly fast.]
>
> --
> Mike Williamshttp://econym.org.uk/gmap
Bubble Sort ! old-school I guess.
FWIW, the sort function can also sort strings. If you have to sort on
multiple fields, just build a large fixed length string.
To right justify an integer,
(" "+someinteger).slice(-10);
To sort backwards, sort forwards. Loop through your forward sorted
array backwards.
To make the "quick sort" algorithm stable (resolve ties
deterministically), append the offset of each record to the end of the
fixed length string. Because it is an integer, be sure to right
justify it. It is also useful to point back to the entire record
containing the other fields you did not sort.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en
-~----------~----~----~----~------~----~------~--~---