Skyline 支持国内常见的地图投影坐标系,包括WGS84、Beijing54、西安80、2000坐标系等,也可以自定义坐标系,比如一些做过参数变换加密的坐标系等。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script type="text/javascript"> function Test() { try { var sg = CreateSGObj(); //alert(sg.CoordServices.SourceCoordinateSystem.WellKnownText); ConvertPos(-635585.73259, 4582417.28002); } catch (e) { alert(e); } } function ConvertPos(x,y) { try { var sg = CreateSGObj(); var fCoord = CreateCoord1(); //alert(fCoord.WellKnownText); var tCoord = CreateCoord2(); //alert(tCoord.WellKnownText); var Coord2D = sg.CoordServices.Reproject(fCoord, tCoord, x, y); alert(Coord2D); sg.Navigate.FlyTo(Coord2D); } catch (e) { alert(e); } } function CreateCoord1() { var sg = CreateSGObj(); return sg.CoordServices.CreateCoordinateSystem("PROJCS["Xian 1980 / 3-degree Gauss-Kruger CM 132E",GEOGCS["Xian 1980",DATUM["Xian_1980",SPHEROID["IAG 1975",6378140,298.257,AUTHORITY["EPSG","7049"]],AUTHORITY["EPSG","6610"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4610"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",132],PARAMETER["scale_factor",1],PARAMETER["false_easting",500000],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AXIS["X",NORTH],AXIS["Y",EAST],AUTHORITY["EPSG","2389"]]"); } function CreateCoord2() { var sg = CreateSGObj(); //return sg.CoordServices.CreateCoordinateSystem("GEOGCS['WGS84 Coordinate System',DATUM['WGS 1984',SPHEROID['WGS1984',6378137,298.257223563],TOWGS84[0,0,0,0,0,0,0],AUTHORITY['EPSG','6326']],PRIMEM['Greenwich',0],UNIT['degree',0.0174532925199433],AUTHORITY['EPSG','4326'],AUTHORITY['SBMG','LAT-LONG,LAT-LONG,WGS84,METERS']]"); return sg.CoordServices.SourceCoordinateSystem; } //------------------------------------------------------------ // 创建sgworld对象 赵贺 2011.04.07. //------------------------------------------------------------ function CreateSGObj() { var obj = $("sgworld"); if (obj == null) { obj = document.createElement('object'); document.body.appendChild(obj); obj.name = "sgworld"; obj.id = "sgworld"; obj.classid = "clsid:3a4f9197-65a8-11d5-85c1-0001023952c1"; } return obj; } function $(id) { return window.document.getElementById(id); } </script> </head> <body > <input id="Button1" type="button" value="button" onclick="Test()" /> <OBJECT ID="TerraExplorer3DWindow" CLASSID="CLSID:3a4f9192-65a8-11d5-85c1-0001023952c1" width="600px" height="400px" ></OBJECT> <OBJECT ID="TerraExplorerInformationWindow" CLASSID="CLSID:3a4f9193-65a8-11d5-85c1-0001023952c1" width="300px" height="400px" ></OBJECT> </body> </html>