您的位置:首页 > 编程语言 > Go语言

arcgis flex api 访问 google 地图

2010-03-14 00:28 645 查看
package
{
import com.esri.ags.SpatialReference;
import com.esri.ags.geometry.Extent;
import com.esri.ags.geometry.MapPoint;
import com.esri.ags.layers.LOD;
import com.esri.ags.layers.TileInfo;
import com.esri.ags.layers.TiledMapServiceLayer;

import flash.net.URLRequest;

import mx.controls.Alert;

public class GoogleMapLayer extends TiledMapServiceLayer
{
public function GoogleMapLayer()
{
super();
buildTileInfo();
setLoaded(true);

}
private var _tileInfo:TileInfo=new TileInfo();
private var _baseURL:String="";

override public function get fullExtent():Extent
{
return new Extent(-9466091.13399388, 4610475.01946595, -8939371.68667449, 5183684.37031855, new SpatialReference(102113));
}
override public function get initialExtent():Extent
{
return new Extent(-9466091.13399388, 4610475.01946595, -8939371.68667449, 5183684.37031855, new SpatialReference(102113));
}

override public function get spatialReference():SpatialReference
{
return new SpatialReference(102113);
}

override public function get tileInfo():TileInfo
{
return _tileInfo;
}

override protected function getTileURL(level:Number, row:Number, col:Number):URLRequest
{

var _baseURL:String="http://khm2.google.com/kh/v=38&hl=zh-CN&x=";

var url:String=_baseURL + col.toString() + "&y=" + row.toString() + "&z=" + level.toString() + "&s=";
return new URLRequest(url);
}

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(0, 1222.99245256249, 4622324.434309),
new LOD(1, 611.49622628138, 2311162.217155),
new LOD(2, 305.748113140558, 1155581.108577),
new LOD(3, 152.874056570411, 577790.554289),
new LOD(4, 76.4370282850732, 288895.277144),
new LOD(5, 38.2185141425366, 144447.638572),
new LOD(6, 19.1092570712683, 72223.819286),
new LOD(7, 9.55462853563415, 36111.909643),
new LOD(8,1.19432856685505, 4513.988705)
];
}
}
}

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:esri="http://www.esri.com/2008/ags"
xmlns:google="*"
>
<mx:Text text="" width="100%"/>
<esri:Map>
<google:GoogleMapLayer id="googleMap" />
</esri:Map>
</mx:Application>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: