Google Map Flex中实现本地搜索的两种方式

var service:HTTPService = new HTTPService(); 

                service.url="http://www.google.com/uds/GlocalSearch";
                service.request.callback="google.search.LocalSearch.RawCompletion";
                service.request.context=0;
                service.request.gll="30633913,104106955,30697437,104170479";
                service.request.gss=".com";
                service.request.hl="zh_cn";
                service.request.key=key;
                service.request.llsep="500,500";
                service.request.lstkp=0;
                service.request.nocache="1244256688516";
                service.request.q=keyword.text;
                service.request.qid="121b37bca2a40c50f";
                service.request.rsz="small";
                service.request.sig="49d5a0a79a3c081f004d76a6c9c34bf7";
                service.request.sll="26.726945,108.442740";    //本地查询的中心点
                service.request.source="gsc";
                service.request.sspn="0.02584,0.030041";
                service.request.v="1.0";
                service.resultFormat ="e4x";
                service.addEventListener(ResultEvent.RESULT, onServerResponse);
                service.addEventListener(FaultEvent.FAULT,onFault);
                service.send();

 

 

var service:HTTPService = new HTTPService();

service.url = 'http://ajax.googleapis.com/ajax/services/search/local';

service.request.v = '1.0';

service.request.q = address.text;

service.request.rsz = "large";

service.request.mrt = typeCombo.selectedItem.data;

service.request.sspn = map.getLatLngBounds().toSpan().toUrlValue();

service.request.sll = map.getCenter().toUrlValue();

var listingType:String = typeCombo.selectedItem.data;

if (listingType == "siterestrict")

{

service.request.mrt = "kmlonly";

var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;

var siteRestrict:String = String(paramObj["siterestrict"]);

service.request.q = "site:" + siteRestrict + " " + address.text; trace(siteRestrict);

}

service.resultFormat = 'text';

service.addEventListener(ResultEvent.RESULT, onServerResponse);

service.send();

 

 

主要是两个不同的地址http://www.google.com/uds/GlocalSearch

http://ajax.googleapis.com/ajax/services/search/local

posted @ 2010-11-09 16:41  千禧牛  阅读(405)  评论(0)    收藏  举报