Larry, thanks for your reply. I was hoping it'd be easier to add the functions I need to a fairly clean map, then I wouldn't have to embarrass myself showing off what a mess I've probably made of the code (smiling).
The URL below uses GDirections and displays driving distances. http://tandem.mayodata.com/tdom/labor_map_test.php?jobsite=704 After posting earlier today, it came to me that A,B,C ordering wasn't sorting distances correctly because the PHP code which generates the markers XML from my database was ordering the results by straight-line distances: $query = sprintf("SELECT concat(address_street, ', ', address_city, ', ', address_state, ' ', address_zipcode) as address, name, regular_rate, overtime_rate, travel_rate, trip_charge, other_charge, other_charge_type, address_lat, address_lng, ( 3959 * acos( cos( radians('%s') ) * cos( radians( address_lat ) ) * cos( radians( address_lng ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( address_lat ) ) ) ) AS distance FROM labor WHERE active='Yes' HAVING distance < '%s' ORDER BY distance LIMIT 0 , 20", mysql_real_escape_string($center_lat), mysql_real_escape_string($center_lng), mysql_real_escape_string($center_lat), mysql_real_escape_string($radius)); I have no idea how to accomplish the same thing with driving distances, but maybe you or someone else on the list can point me in the right direction. Thanks again, Chuck ----- Original Message ---- From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> To: Google Maps API <[email protected]> Sent: Wednesday, September 3, 2008 7:18:58 PM Subject: Re: Store Locator - Driving distances instead of straight-line distances? On Sep 3, 3:48 pm, charlesmayo53 <[EMAIL PROTECTED]> wrote: > Hi all, hoping I can get a bit of help with a store locator map. I've > pretty much taken bits of demo code from the Google site and managed > to cobble together a map which does nearly everything I need it to do, > with the exception that I need to display driving distances from the > map center in the sidebar and markers instead of straight-line > distances. > > I've experimented with GDirections() and have successfully extracted > the driving distances in other versions of the map, but keep getting > tripped up in the asynchronous nature of the API -- the GDirections > methods don't come back in the correct A,B,C order (I'm using > lettered markers and sidebar entries) and visually checking the > returned entries, the sidebar wouldn't be sorted in nearest-to- > farthest order even if they were in A,B,C order. > > My map is at: > > http://tandem.mayodata.com/tdom/phpsqlsearch_map_old.php?jobsite=704 > > Could someone suggest a way to implement the features I need, i.e. > driving distances instead of straight-line, a properly A,B,C ordered > sidebar in nearest to farthest order? Don't see any attempt to put GDirections in there. Perhaps you could give us a link to your best attempt(s) so we can see what you are trying to do and where you are running into problems. -- Larry --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
