My goal was to have a couple buttons that a user could click to do predefined searches. In my case they would be for Veterinarians and Kennels. And, actually, that part was easy because it was a basic feature of the local search map. However, I didn’t count on this other “default” feature: “By default, when a search completes, the search results are placed on your map and they are also listed in tabular form above the search form input.” The tabular form obliterated the map points that I was trying to show.
I spent hours looking for a clue about how to get rid of the tabular result list but I couldn’t find anything. I wasn’t even sure what to call that “feature” so it was difficult to search for answers. I finally pasted one of the map URLs into my browser and found what I was looking for.
The nice thing about adding google.maps.LocalSearch() to your Google map is that it allows you to pre-load the search so you can do (in my case) an “execute('veterinarians')” or “execute('kennels')” search by clicking on a button.
// These options will be applied to the search dialog
var options = {
//This text shows in the search dialog
searchFormHint: 'Click a Button or, type here!',
// This stops the initial info window from poping up
suppressInitialResultSelection: true,
//sets the map zoom limit
zoomLimit: 13,
// This suppresses the TAB LIST that obliterates the map points!
resultList : google.maps.LocalSearch.RESULT_LIST_SUPPRESS
};
// This creates the Search Object "mySearch" with the above options
map.addControl(mySearch = new google.maps.LocalSearch(options));
// These are the onClick events for the search buttons which use
//mySearch object and the execute method
function displaySearch(search_string) {
if (search_string == "vet")
{
mySearch.execute('veterinarians');
}
else if (search_string == "kennel") {
mySearch.execute('kennels');
}
}
// HTML Buttons that preform a "predefined" search when clicked
This isn't a detailed description of exactally what you need but, it may give you some ideas of what you can do with Google Maps. I was very surprised to learn how much you can do to customize your map and really amazed at all the Methods and Options.
Terry,
ReplyDeleteI have had similar problems searching for 'features' that i didn't exactly understand. One thing that has helped me in the past was to think like a thesaurus and reword my search until I get something that I want. Hope that might help you in the future!
Yeah Colin, I tried a lot of that but it was made more dificult by not knowing exactly what I was searching for. I was really frustrated after searching for about everything I could think of. I am not sure why I even decided to paste one of the URLs from my page into my browser but this is the URL I used:
ReplyDelete"http://www.google.com/uds/solutions/localsearch/gmlocalsearch.js"
I just pasted http://www.google.com/uds/solutions
into my browser and that gave me an error so I pasted this and it took me right to the answer:
http://www.google.com/uds/solutions/localsearch
Anyway, I appreciate your thoughts and maybe I should have used a Thesaurus. Well, maybe next time.
Terry,
ReplyDeleteGreat post! Thanks for sharing your knowledge with the rest of us.
Thanks Terry, I have had problems with my google map, and you really helped me out.
ReplyDelete