skyline非常头痛的坐标转换示例(代码)
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
function CreateCoord1() {
return sgworld.CoordServices.CreateCoordinateSystem("PROJCS[\"WGS 84 / UTM zone
50N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS
84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Gre enwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"912 2\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin \",0],PARAMETER[\"central_meridian\",117],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\ ",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\ ",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32650\"]]");
}
function CreateCoord2() {
//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']],PRI MEM['Greenwich',0],UNIT['degree',0.0174532925199433],AUTHORITY['EPSG','4326'],AUTHORITY['SBMG','LA T-LONG,LAT-LONG,WGS84,METERS']]");
return sgworld.CoordServices.SourceCoordinateSystem;
}
function ConvertPos(x, y) {
try {
var fCoord = CreateCoord1();
//alert(fCoord.WellKnownText);
var tCoord = CreateCoord2();
//alert(tCoord.WellKnownText);
var Coord2D = sgworld.CoordServices.Reproject(fCoord, tCoord, x + 121052.084, y - 11074.711);
// alert(Coord2D.X);
// alert(Coord2D.Y);
//alert(Coord2D);
//sgworld.Navigate.FlyTo(Coord2D);
return Coord2D;
}
catch (e) {
alert(e);
}
}
function ConvertPos1(x, y) {
try {
var fCoord = CreateCoord1();
//alert(fCoord.WellKnownText);
var tCoord = CreateCoord2();
//alert(tCoord.WellKnownText);
var Coord2D = sgworld.CoordServices.Reproject(tCoord, fCoord, x, y);
alert(Coord2D.X);
alert(Coord2D.Y);
//alert(Coord2D);
//sgworld.Navigate.FlyTo(Coord2D);
return Coord2D;
}
catch (e) {
alert(e);
}
}