

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.
Here is the XML file that returned from the query, as you can see at the bottom of the XML file the returned coordinates of the college of business is -83.6161001, 42.2411090
Here is the JSON file that was returned from the query, as you can see at the bottom of the JSON file the returned coordinates of the college of business is the same as the XML file
In the next blog post I will show you a basic way to use this coordinate to place a marker at this point on a google map
Enjoy!!
These are just a few of the configurable options when implementing a google map into your website. I highly recommend visiting the google map api reference documentation to familiarize yourself with all the options there are to offer
Enjoy!!
Since we are programming in Javascript, go to the Javascript Maps API Example in the middle of the screen and copy and paste all of the text(including your API key) from the script tag to the /script tag into your webpages header. This will allow you to access the google maps API to implement into your webpage.
The next step will be to program your html page with a map object in order to place the google map into. To do this you will have insertin the body of the html page. The "id" will be used by the the google maps API to insert the map into this object. The width and height can be set to your desired map size along with the position of the map on your webpage. You can purchase an HTML or CSS stylesheet guide like this one to assist in the setup of this element. http://www.amazon.com/HTML-XHTML-Sixth-Elizabeth-Castro/dp/0321430840/ref=sr_1_1?ie=UTF8&s=books&qid=1254182146&sr=8-1
Next will be to add the javascript to your webpage. For ease of demonstration we can insert the following text directly into the header of your webpage, however when implementing into your project you may want to follow the Head First AJAX books advice and insert the code into a separate javascript file.
Javascript Code Breakdown:
var map = new GMap2(document.getElementById("map_canvas"));
This creates the google map and inserts it into the "map_canvas" object that was created in the body of the html code. Remember, our code has made this map 500px wide and 300px high
map.setCenter(new GLatLng(42.240963,-83.618987), 13);>>
This sets the center of the map to the map coordinates of your choice, in my case I have set the center to the coordinates for Ypsilanti, MI
One final step is to set the javascript to run after the html loads by editing the body tag of the html document as follows. This will initialize the map and place it into the "map_canvas" object.
The final code should look like this:
You can see the map demonstration here:
http://people.emich.edu/jguest//IS449W/google/index.html
As you can see from the final product, the map shows Ypsilanti, MI but doesn't show any map controls. I will address this issue in my next post.
Enjoy!!