<? Php
$ Weidu = $ _ REQUEST ['weidu'];
$ Jingdu = $ _ REQUEST ['jingdu']; $ Keywords = $ _ REQUEST ['keyword']; If ($ keywords = 'Unilever hotel '){
$ Suofang = 11; } Else { $ Suofang = 14; } $ Str = '
<Head> <Meta http-equiv = "Content-Type" content = "text/html; charset = utf-8"/> <Meta name = "viewport" content = "initial-scale = 1.0, user-scalable = no"/> <Style type = "text/css"> Body, # allmap {width: 100%; height: 100%; overflow: hidden; margin: 0 ;} </Style> <Script type = "text/javascript" src = "http://api.map.baidu.com/api? V = 2.0 & ak = your key (you can apply for it easily) "> </script> <Script type = "text/javascript" src = "http://developer.baidu.com/map/jsdemo/demo/convertor.js"> </script> <Title> Search by central point keyword </title> </Head> <Body> <Div id = "allmap"> </div> </Body> </Html> <Script type = "text/javascript"> // Convert Google coordinates to Baidu coordinates Var xx = '. $ jingdu .'; Var yy = '. $ weidu .'; Var ggPoint = new BMap. Point (xx, yy ); // Callback function after coordinate transformation
TranslateCallback = function (point ){ // Alert (point. lng + "," + point. lat ); Var map = new BMap. Map ("allmap"); // create a Map instance Map. centerAndZoom (new BMap. Point (point. lng, point. lat), '. $ suofang.'); // you can set the center Point and map zoom level when initializing. Var local = new BMap. LocalSearch (map ,{ RenderOptions: {map: map, autoViewport: true} }); Map. addControl (new BMap. ScaleControl ()); Map. enableScrollWheelZoom (true ); Map. addControl (new BMap. NavigationControl (); // add the default zoom/pan control Var point = new BMap. Point (point. lng), (point. lat )); Map. centerAndZoom (point, '. $ suofang .'); Var marker = new BMap. Marker (point); // create annotation Map. addOverlay (marker); // add the annotation to the map Marker. setAnimation (BMAP_ANIMATION_BOUNCE); // specifies the animation that exists. // Visual range search
Var local = new BMap. LocalSearch (map ,{ RenderOptions: {map: map} }); Local. searchInBounds ("'. $ keywords.'", map. getBounds ()); } SetTimeout (function (){
BMap. Convertor. translate (ggPoint, 2, translateCallback); // Convert the GCJ-02 coordinates to Baidu coordinates },300 ); </Script> ';
Echo $ str;
?>
|