The actionscripts script used to call Baidu map is a "GIS rush" blog on the Internet. Link: http://www.gisall.com/html/72/124272-6284.html 图 API example. This is a GoogleMap example: Package COM. ESRI. viewer {import Baidu. map. basetype. lnglat; import Baidu. map. core. map; import COM. ESRI. AGS. spatialreference; import COM. ESRI. AGS. geometry. extent; import COM. ESRI. AGS. geometry. mappoint; import COM. ESRI. AGS. layers. tiledmapservicelayer; import COM. ESRI. AGS. layers. supportclasses. looss; import COM. ESRI. AGS. layers. supportclasses. tileinfo; import flash.net. URLRequest; // extends the tiledmapservicelayer layer to load the public class googlemaplayer extends tiledmapservicelayer {private VaR _ tileinfo: tileinfo = new tileinfo (); Private VaR _ baseurl: String = ""; // "http: // 192.168.10.190/testgd/_ alllayers"; Public var mapstyle: String = ""; private var ints: Int = 0; private var strurl: string = ""; Public Function googlemaplayer () {super (); buildtileinfo (); setloaded (true) ;}override public function get fullextent (): extent {return new extent (-20037508.342787,-20037508.342787, 20037508.342787, 20037508.342787, new spatialreference (2362);} override public function get initialextent (): extent {return new extent (12840697.0597065, 2671847.44992804, 13011984.1619692, 2869874.36172011, new spatialreference (2362);} override public function get spatialreference (): spatialreference {return New spatialreference (102113);} override public function get tileinfo (): tileinfo {return _ tileinfo;} // obtain the vector map override protected function gettileurl (Level: Number, row: Number, Col: Number): URLRequest {var s: string = "Galileo ". substring (0, (3 * X + Y) % 8); var URL: string; // get traffic map if (mapstyle = "vector ") {url = "http: // MT" + (COL % 4) + ".google.cn/vt/lyrs?m@15800?&hl=zh-cn&gl=cn&" + "x =" + Col + "&" + "Y =" + row + "&" + "z =" + level + "&" + "S "= "+ S ;}} private function padString(text:String, size:int, ch:String):String{while (text.length < size){text = ch + text;}return text;}private function buildTileInfo():void{_tileInfo.height=256;_tileInfo.width=256;_tileInfo.origin=new MapPoint(-20037508.342787, 20037508.342787);_tileInfo.spatialReference=new SpatialReference(102113);_tileInfo.lods = [new LOD(1, 78271.5169639999, 295828763.795777),new LOD(2, 39135.7584820001, 147914381.897889),new LOD(3, 19567.8792409999, 73957190.948944),new LOD(4, 9783.93962049996, 36978595.474472),new LOD(5, 4891.96981024998, 18489297.737236),new LOD(6, 2445.98490512499, 9244648.868618), new LOD(7, 1222.99245256249, 4622324.434309), new LOD(8, 611.49622628138, 2311162.217155), new LOD(9, 305.748113140558, 1155581.108577), new LOD(10, 152.874056570411, 577790.554289), new LOD(11, 76.4370282850732, 288895.277144), new LOD(12, 38.2185141425366, 144447.638572), new LOD(13, 19.1092570712683, 72223.819286), new LOD(14, 9.55462853563415, 36111.909643), new LOD(15, 4.77731426794937, 18055.954822),new LOD(16, 2.38865713397468, 9027.977411), new LOD(17, 1.19432856685505, 4513.988705), new LOD(18, 0.597164283559817, 2256.994353),new LOD(19, 0.298582141647617, 1128.497176)];}
The difference between the two is that the gettileurl method is rewritten in the middle. Baidu map is called like this.
// Obtain the vector map override protected function gettileurl (Level: Number, row: Number, Col: Number): URLRequest {
VaR ZOOM: Int = level-1; var offsetx: Int = math. pow (2, zoom) as int; var offsety: Int = offsetx-1; var numx: Int = col-offsetx; var numy: Int = (-row) + offsety; zoom = level + 1; var num: Int = (COL + row) % 8 + 1; var URL: String = ""; // obtain the vector map if (mapstyle = "vector") {url = "http: // Q" + num + ".baidu.com/it/u=x=" + numx + "; y = "+ numy +"; Z = "+ zoom +"; V = 014; type = web & fm = 44 ";}
}
Finally, I added the map of googelmap and the satellite map + Road Map combined call, Baidu's no topographic map, so only write satellite map + Road.
GoogleMap:
Topographic Map url = "http: // MT" + (COL % 4) + ".google.cn/vt/lyrs20.t@128,r@17700?&hl=zh-cn&gl=cn&" +
"X =" + Col + "&" +
"Y =" + row + "&" +
"Z =" + level + "&" +
"S =" + S;
Satellite map url = "http: // MT" + (COL % 4) + ".google.cn/vt/lyrs?s@#&hl=zh-cn&gl=cn&src=app&" +
"X =" + Col + "&" +
"Y =" + row + "&" +
"Z =" + level + "&" +
"S =" + S;
Road map url = "http: // MT" + (COL % 4) + ".google.cn/vt/imgtp?png32&lyrs=h@17400?&hl=zh-cn&gl=cn&src=app&" +
"X =" + Col + "&" +
"Y =" + row + "&" +
"Z =" + level + "&" +
"S =" + S;
Baidumap:
Satellite map url = "http: // Q" + num + ".baidu.com/it/u=x=" + numx + "; y =" + numy + "; Z =" + zoom + "; V = 009; type = sate & fm = 46 ";
Road map url = "http: // Q" + num + ".baidu.com/it/u=x=" + numx + "; y =" + numy + "; Z =" + zoom + "; V = 014; type = trans & fm = 47 ";