Google maps custom local search / search control
I have two questions about google maps local search. Here is my code:
var options = {
onSearchCompleteCallback:function(searcher) {
// content of onSearchCompleteCallback function
// creates markers and applies addresses to a result list
// at this point code isn't necessary, because this function already works
}
};
localSearch = new google.maps.LocalSearch(options);
map.addControl(localSearch);
- How can I avoid creating Google's markers and result li开发者_Python百科st? -> I want to display only my own markers...
- How can I submit the "google search bar" programmatically in JavaScript?
Ok, I try to solve it in another way. At first I created a google search form and a local searcher (see code below). But an execution is bringing no results... Any ideas?
var SearchForm = null;
var Searcher = null;
function GetSearchResult() {
}
function RunMapSearch(searchForm) {
Searcher.setCenterPoint(center);
Searcher.execute(searchForm.input.value);
}
function CreateMapSearch() {
// Creating search form
SearchForm = new google.search.SearchForm(false, document.getElementById("SearchBar"));
SearchForm.setOnSubmitCallback(this, RunMapSearch);
// Creating searcher for local search
Searcher = new google.search.LocalSearch();
Searcher.setCenterPoint(center);
Searcher.setSearchCompleteCallback(null, GetSearchResult);
}
精彩评论