投影带和中央经线计算
/**
* 投影带的带号计算:通过用户输入的经纬度及定义的投影带宽度,得到该经纬度下投影带的带号
* @param long 输入 用户输入的经度
* @param projectedBandWidth 输入 用户定义的投影带宽度
* @returns {number} 返回 经纬度下投影带的带号
*/
function bandNumberCalculation(long, projectedBandWidth) {
var num;
if (long <= 180) {
if (projectedBandWidth === 6) {
num = Math.floor(long / projectedBandWidth) + 1;
} else if (projectedBandWidth === 3) {
num = Math.floor((long - 1.5) / projectedBandWidth) + 1;
} else {
num = 0;
}
} else {
num = extractBandNumber(long);
}
return num;
}
/**
* 计算中央经线
* @param {*} lon 输入 用户输入的经度
* @param {*} projectedBandWidth 输入 用户定义的投影带宽度
* @returns {lon} 返回 中央经线
*/
function lonCalculation(lon,projectedBandWidth){
var num=bandNumberCalculation(lon,projectedBandWidth);
var lon;
if(projectedBandWidth===6){
lon=num*6-3;
}else if(projectedBandWidth===3){
lon=num*3;
}
return lon;
}
bandNumberCalculation(113.83591066844463,6);
// result :19
lonCalculation(113.83591066844463,6);
// result :111
七参数投影转换
/*七参数
dx:44.745645865798,
dy:-100.37348291277885,
dz:-79.37086255592294,
rx:0.05323744846828353,
ry:1.6001266383655595,
rz:3.12522766589074,
m :4.1736175275126327
*/
//不同基准转换
proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");
proj4.defs("EPSG:21419", "+proj=tmerc +ellps=krass +lat_0=0 +lon_0=111 +k=1 +x_0=19500000 +y_0=0 +towgs84=44.745645865798,-100.37348291277885,-79.37086255592294,0.05323744846828353,1.6001266383655595,3.12522766589074,4.1736175275126327 +units=m +no_defs");
var bejing54tmerc_cgcs2000=proj4("EPSG:21419", "EPSG:4490", [19759978.64965164,3841131.286169876]);
bejing54tmerc_cgcs2000
/*
result:113.83649963967547,34.664948676078915
*/
//不同基准转换
proj4.defs("EPSG:4490", "+proj=longlat +ellps=GRS80 +no_defs");
proj4.defs("EPSG:4214", "+proj=longlat +ellps=krass +towgs84=44.745645865798,-100.37348291277885,-79.37086255592294,0.05323744846828353,1.6001266383655595,3.12522766589074,4.1736175275126327 +no_defs");
var gcs2000 = proj4("EPSG:4214", "EPSG:4490", [113.83591066844463, 34.664758065382884]);
/*
113.83649963963823,34.6649486761037
*/
//相同基准转换
proj4.defs("EPSG:4214", "+proj=longlat +ellps=krass +no_defs");
proj4.defs("EPSG:21419", "+proj=tmerc +ellps=krass +lat_0=0 +lon_0=111 +k=1 +x_0=19500000 +y_0=0 +units=m +no_defs");
var beijing54=proj4("EPSG:21419","EPSG:4214",[19759979.64775164,3841140.167206965]);
beijing54
/*
19759978.64965164,3841131.286169876
*/
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容