Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.4: Replace the phone book widget's mapping service' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.4: Replace the phone book widget's mapping service
Authored by: drewk on Apr 30, '05 04:03:52PM
This is a wonderful hint!

However, there is still a bug in Apple's Yellow Pages widget carried into this hint.
Apple uses DA+ for the Yellow Page data. DA+ listings may or may not include the Suite Number like this:

Michele Coulon Dessertiere
7556 Fay Ave # D
La Jolla CA 92037

If the suite number is included, this gets added to the URL sent to Google (or Mapquest.) With the extra suite or unit in the URL, neither this Google Map hint not Mapquest default from Apple will display a map.

Here is the fix. Add a regular expression that removes the '#' and the space before it and everything after it. Instead of the code in step 6 contained in the Google Map hint, use this code so that both an address with or without a suite number will display correctly in Google Map:

var mapURL = "http://maps.google.com/maps?q=";
//The following RegEx removes the unit or suite number 
//that otherwise breaks Google Maps
mapURL += URLEncode( singleResult.address.replace(/(\s*#.*$)/, "") );
mapURL += ",+"; 
mapURL += URLEncode( singleResult.zip );
// add "&t=k" if you want sat view
mapURL += "&hl=en";

Thanks again for the great hint!

drewk

[ Reply to This | # ]