开发者

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);
  1. How can I avoid creating Google's markers and result li开发者_Python百科st? -> I want to display only my own markers...
  2. 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);
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜