失效链接处理 |
mysql常用坐标系转换函数 PDF 下载
本站整理下载:
相关截图:
主要内容:
-- ----------------------------
-- Function structure for 84togcj2Lat
-- ----------------------------
DROP FUNCTION IF EXISTS `84togcj2Lat`;
delimiter ;;
CREATE FUNCTION `84togcj2Lat`(`lon` decimal,`lat` decimal)
RETURNS varchar(30) CHARSET utf8
BEGIN
DECLARE pi double DEFAULT 3.1415926535897932384626;
DECLARE x_pi double DEFAULT 3.14159265358979324 * 3000.0 / 180.0;
DECLARE a double DEFAULT 6378245.0;
DECLARE ee double DEFAULT 0.00669342162296594323;
DECLARE dLat double DEFAULT 0.0;
DECLARE dLon double DEFAULT 0.0;
DECLARE magic double DEFAULT 0.0;
DECLARE sqrtMagic double DEFAULT 0.0;
DECLARE mgLat double DEFAULT 0.0;
DECLARE mgLon double DEFAULT 0.0;
DECLARE radLat double DEFAULT 0.0;
set dLat = transformLat(lon - 105.0, lat - 35.0);
set dLon = transformLon(lon - 105.0, lat - 35.0);
set radLat = lat / 180.0 * pi;
set magic = 1 - ee * sin(radLat) * sin(radLat);
set sqrtMagic = sqrt(magic);
set dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
set dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * pi);
set mgLat = lat + dLat;
set mgLon = lon + dLon;
RETURN mgLat;
END
;;
delimiter ;
-- ----------------------------
-- Function structure for 84togcj2Lon
-- ----------------------------
DROP FUNCTION IF EXISTS `84togcj2Lon`;
delimiter ;;
CREATE FUNCTION `84togcj2Lon`(`lon` decimal,`lat` decimal)
RETURNS varchar(30) CHARSET utf8
BEGIN
DECLARE pi double DEFAULT 3.1415926535897932384626;
DECLARE x_pi double DEFAULT 3.14159265358979324 * 3000.0 / 180.0;
DECLARE a double DEFAULT 6378245.0;
DECLARE ee double DEFAULT 0.00669342162296594323;
DECLARE dLat double DEFAULT 0.0;
DECLARE dLon double DEFAULT 0.0;
DECLARE magic double DEFAULT 0.0;
DECLARE sqrtMagic double DEFAULT 0.0;
DECLARE mgLat double DEFAULT 0.0;
DECLARE mgLon double DEFAULT 0.0;
DECLARE radLat double DEFAULT 0.0;
set dLat = transformLat(lon - 105.0, lat - 35.0);
set dLon = transformLon(lon - 105.0, lat - 35.0);
set radLat = lat / 180.0 * pi;
set magic = 1 - ee * sin(radLat) * sin(radLat);
set sqrtMagic = sqrt(magic);
set dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
set dLon = (dLon * 180.0) / (a / sqrtMagic * cos(radLat) * pi);
set mgLat = lat + dLat;
set mgLon = lon + dLon;
RETURN mgLon;
END
;;
delimiter ;
-- ----------------------------
-- Function structure for bd09togcj02lat
-- ----------------------------
DROP FUNCTION IF EXISTS `bd09togcj02lat`;
delimiter ;;
CREATE FUNCTION `bd09togcj02lat`(`lat` double,`lon` double)
RETURNS double
BEGIN
DECLARE x double DEFAULT 0;
DECLARE y double DEFAULT 0;
DECLARE z double DEFAULT 0;
DECLARE pi double DEFAULT 3.1415926535897932384626;
DECLARE theta double DEFAULT 0;
DECLARE gg_lon double DEFAULT 0;
DECLARE gg_lat double DEFAULT 0;
set x = lat - 0.0065, y = lon - 0.006;
set z = sqrt(x * x + y * y) - 0.00002 * sin(y * pi);
set theta = atan2(y, x) - 0.000003 * cos(x * pi);
|