百度坐标转换,以及国测局、WGS84(GPS)坐标系之间的转换札记

从百度地图获取水库位置及名字,并将其BD09坐标系转为WGS84坐标系 在`get_reservoirs`函数中需要传入指定的经度和纬度信息,在函数中使用请求地址和参数来获取周围指定范围内的所有水库信息。在`bd09_to_wgs84`函数中,通过调用百度API将百度坐标系转换为wgs84坐标系,并返回Point对象。然后,通过调用API接口获取到指定区域内的水库信息,其JSON格式的响应包含了水库的名称和经纬度坐标信息。'''将百度坐标系(bd09ll)下的Point对象转为wgs84坐标系''''''获取指定经纬度周围5公里范围内的所有水库信息,并返回''' 阅读详情

背景介绍

    坐标系转换,网上内容也比较多、也比较杂,有的可以运行,有的则各种问题,这里记录并加以补充,最后封装了常用坐标系转换工具。亲测可运行!

  • WGS84:即地球坐标系,国际上通用的坐标系。谷歌地图采用的是WGS84地理坐标系(中国范围除外)
  • GCJ02:即火星坐标系,中国国家测绘局制订。由WGS84坐标系经加密而成,谷歌中国地图和搜搜中国均采用的是GCJ02
  • BD09ll:即百度坐标系,经GCJ02加密后的坐标系,百度坐标系除了baidu09ll之外还有baidu09mc(墨卡托坐标)坐标
  • 搜狗坐标系、图吧坐标系等也是在GCJ02基础上加密而成

坐标转换接口

先定义一个表示坐标的JavaBean:

/**
 * @author zhanghuigen@cetiti.com
 * @since 0.1.0
 **/
public class CoordinateBean {
    /**
     * 定位的几个基本信息
     */
    private double longitude;

    private double latitude;

    private boolean isChina;

    public CoordinateBean() {

    }

    public CoordinateBean(double longitude, double latitude) {
        this.longitude = longitude;
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public boolean isChina() {
        return isChina;
    }

    public void setChina(boolean china) {
        this.isChina = china;
    }

    @Override
    public String toString(){
        return this.latitude + "_" + this.longitude;
    }

}

坐标转换工具类:

/**
 *
 * @author zhanghuigen@cetiti.com
 * @since 0.1.0
 *
 */

public class PositionConvertUtil {

    private static final double A = 6378245.0;
    private static final double PI = 3.1415926535897932384626;
    private static final double EE = 0.00669342162296594323;
    private static final double LON_BOUNDARY_MIN = 72.004;
    private static final double LAT_BOUNDARY_MIN = 0.8293;
    private static final double LON_BOUNDARY_MAX = 137.8347;
    private static final double LAT_BOUNDARY_MAX = 55.8271;
    private static final double X_PI = 3.14159265358979324 * 3000.0 / 180.0;

    /**
     * wgs84  to   gcj02
     * @param lat lat
     * @param lon lon
     * @return coordinate
     */
    public CoordinateBean wgs84ToGcj02(double lat, double lon) {
        CoordinateBean info = new CoordinateBean();
        if (outOfChina(lat, lon)) {
            info.setChina(false);
            info.setLatitude(lat);
            info.setLongitude(lon);
        }else {
            double dLat = transformLat(lon - 105.0, lat - 35.0);
            double dLon = transformLon(lon - 105.0, lat - 35.0);
            double radLat = lat / 180.0 * PI;
            double magic = Math.sin(radLat);
            magic = 1 - EE * magic * magic;
            double sqrtMagic = Math.sqrt(magic);
            dLat = (dLat * 180.0) / ((A * (1 - EE)) / (magic * sqrtMagic) * PI);
            dLon = (dLon * 180.0) / (A / sqrtMagic * Math.cos(radLat) * PI);
            double mgLat = lat + dLat;
            double mgLon = lon + dLon;
            info.setChina(true);
            info.setLatitude(mgLat);
            info.setLongitude(mgLon);
        }
        return info;
    }

    /**
     * gcj02  to  wgs84
     * @param lat lat
     * @param lon lat
     * @return coordinate
     */
    public CoordinateBean gcj02ToWgs84(double lat, double lon) {
        CoordinateBean info = new CoordinateBean();
        CoordinateBean gps = transform(lat, lon);
        double lontitude = lon * 2 - gps.getLongitude();
        double latitude = lat * 2 - gps.getLatitude();
        info.setChina(gps.isChina());
        info.setLatitude(latitude);
        info.setLongitude(lontitude);
        return info;
    }

    /**
     * 百度坐标系 (BD-09ll) 与 火星坐标系 (GCJ-02)的转换
     * 即 百度 转 谷歌中国、高德
     * @param bdLat bdLat
     * @param bdLon bdLon
     * @return coordinate
     */
    public CoordinateBean bd09tToGcj02(double bdLat,double bdLon){
        double x = bdLon - 0.0065;
        double y = bdLat - 0.006;
        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * X_PI);
        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * X_PI);
        double ggLng = z * Math.cos(theta);
        double ggLat = z * Math.sin(theta);
        return new CoordinateBean(ggLng,ggLat);
    }



    /**
     * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09ll) 的转换
     * 即谷歌中国、高德 转 百度
     * @param lon lng
     * @param lat lat
     * @return coordinate
     */
    public CoordinateBean gcj02ToBd09(double lat, double lon){
        double z = Math.sqrt(lon * lon + lat * lat) + 0.00002 * Math.sin(lat * X_PI);
        double theta = Math.atan2(lat, lon) + 0.000003 * Math.cos(lon * X_PI);
        double bdLng = z * Math.cos(theta) + 0.0065;
        double bdLat = z * Math.sin(theta) + 0.006;
        return new CoordinateBean(bdLng,bdLat);
    }

    /**
     * baidu09ll to wgs84
     * 即谷歌中国、高德 转 百度
     * @param lat lat
     * @param lon lng
     * @return coordinate
     */
    public CoordinateBean baidu09ToWgs84(double lat, double lon){
        CoordinateBean info = bd09tToGcj02(lat,lon);
        info = gcj02ToWgs84(info.getLatitude(),info.getLongitude());
        return info;
    }

    /**
     * 这里的传参是WGS84 即gps坐标
     * @param lat lat
     * @param lon lon
     * @return boolean
     */
    private boolean outOfChina(double lat, double lon) {
        if (lon < LON_BOUNDARY_MIN || lon > LON_BOUNDARY_MAX){
            return true;
        }
        return lat < LAT_BOUNDARY_MIN || lat > LAT_BOUNDARY_MAX;
    }

    private double transformLon(double x, double y) {
        double ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1
                * Math.sqrt(Math.abs(x));
        ret += (20.0 * Math.sin(6.0 * x * PI) + 20.0 * Math.sin(2.0 * x * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(x * PI) + 40.0 * Math.sin(x / 3.0 * PI)) * 2.0 / 3.0;
        ret += (150.0 * Math.sin(x / 12.0 * PI) + 300.0 * Math.sin(x / 30.0 * PI)) * 2.0 / 3.0;
        return ret;
    }

    private double transformLat(double lng,double lat) {
        double ret = -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
        ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
        ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
        return ret;
    }

    private CoordinateBean transform(double lat, double lon) {
        CoordinateBean info = new CoordinateBean();
        if (outOfChina(lat, lon)) {
            info.setChina(false);
            info.setLatitude(lat);
            info.setLongitude(lon);
            return info;
        }
        double dLat = transformLat(lon - 105.0, lat - 35.0);
        double dLon = transformLon(lon - 105.0, lat - 35.0);
        double radLat = lat / 180.0 * PI;
        double magic = Math.sin(radLat);
        magic = 1 - EE * magic * magic;
        double sqrtMagic = Math.sqrt(magic);
        dLat = (dLat * 180.0) / ((A * (1 - EE)) / (magic * sqrtMagic) * PI);
        dLon = (dLon * 180.0) / (A / sqrtMagic * Math.cos(radLat) * PI);
        double mgLat = lat + dLat;
        double mgLon = lon + dLon;
        info.setChina(true);
        info.setLatitude(mgLat);
        info.setLongitude(mgLon);
        return info;
    }
}

百度坐标系之间的转换(即baidu09ll转baidu09mc)

/**
 * @author zhanghuigen@cetiti.com
 * @since 0.1.0
 **/
public class CoordinatesConvert {
    private static double[] MCBAND = {12890594.86, 8362377.87, 5591021d, 3481989.83, 1678043.12, 0d};
    private static double[] LLBAND = {75d, 60d, 45d, 30d, 15d, 0d};
    private static double[][] MC2LL = {{1.410526172116255e-8, 0.00000898305509648872, -1.9939833816331, 200.9824383106796, -187.2403703815547, 91.6087516669843, -23.38765649603339, 2.57121317296198, -0.03801003308653, 17337981.2}, {-7.435856389565537e-9, 0.000008983055097726239, -0.78625201886289, 96.32687599759846, -1.85204757529826, -59.36935905485877, 47.40033549296737, -16.50741931063887, 2.28786674699375, 10260144.86}, {-3.030883460898826e-8, 0.00000898305509983578, 0.30071316287616, 59.74293618442277, 7.357984074871, -25.38371002664745, 13.45380521110908, -3.29883767235584, 0.32710905363475, 6856817.37}, {-1.981981304930552e-8, 0.000008983055099779535, 0.03278182852591, 40.31678527705744, 0.65659298677277, -4.44255534477492, 0.85341911805263, 0.12923347998204, -0.04625736007561, 4482777.06}, {3.09191371068437e-9, 0.000008983055096812155, 0.00006995724062, 23.10934304144901, -0.00023663490511, -0.6321817810242, -0.00663494467273, 0.03430082397953, -0.00466043876332, 2555164.4}, {2.890871144776878e-9, 0.000008983055095805407, -3.068298e-8, 7.47137025468032, -0.00000353937994, -0.02145144861037, -0.00001234426596, 0.00010322952773, -0.00000323890364, 826088.5}};
    private static double[][] LL2MC = {{-0.0015702102444, 111320.7020616939, 1704480524535203d, -10338987376042340d, 26112667856603880d, -35149669176653700d, 26595700718403920d, -10725012454188240d, 1800819912950474d, 82.5}, {0.0008277824516172526, 111320.7020463578, 647795574.6671607, -4082003173.641316, 10774905663.51142, -15171875531.51559, 12053065338.62167, -5124939663.577472, 913311935.9512032, 67.5}, {0.00337398766765, 111320.7020202162, 4481351.045890365, -23393751.19931662, 79682215.47186455, -115964993.2797253, 97236711.15602145, -43661946.33752821, 8477230.501135234, 52.5}, {0.00220636496208, 111320.7020209128, 51751.86112841131, 3796837.749470245, 992013.7397791013, -1221952.21711287, 1340652.697009075, -620943.6990984312, 144416.9293806241, 37.5}, {-0.0003441963504368392, 111320.7020576856, 278.2353980772752, 2485758.690035394, 6070.750963243378, 54821.18345352118, 9540.606633304236, -2710.55326746645, 1405.483844121726, 22.5}, {-0.0003218135878613132, 111320.7020701615, 0.00369383431289, 823725.6402795718, 0.46104986909093, 2351.343141331292, 1.58060784298199, 8.77738589078284, 0.37238884252424, 7.45}};

    /**
     * 墨卡托坐标转经纬度坐标
     * @param x x
     * @param y y
     * @return map
     */
    public Map<String, Double> convertMC2LL(double x, double y) {
        double[] cF = null;
        x = Math.abs(x);
        y = Math.abs(y);
        for (int cE = 0; cE < MCBAND.length; cE++) {
            if (y >= MCBAND[cE]) {
                cF = MC2LL[cE];
                break;
            }
        }
        Map<String,Double> location = converter(x, y, cF);
        location.put("lng",location.get("x"));
        location.remove("x");
        location.put("lat",location.get("y"));
        location.remove("y");
        return location;
    }

    /**
     * 经纬度坐标转墨卡托坐标, 已做小数位保留(8位、10位)
     * @param lng lonti
     * @param lat lati
     * @return map
     */
    public String convertLL2MC(Double lng, Double lat) {
        double[] cE = null;
        lng = getLoop(lng, -180, 180);
        lat = getRange(lat, -74, 74);
        for (int i = 0; i < LLBAND.length; i++) {
            if (lat >= LLBAND[i]) {
                cE = LL2MC[i];
                break;
            }
        }
        if (cE!=null) {
            for (int i = LLBAND.length - 1; i >= 0; i--) {
                if (lat <= -LLBAND[i]) {
                    cE = LL2MC[i];
                    break;
                }
            }
        }
        Map<String, Double> map =  converter(lng,lat, cE);
        double x = map.get("x");
        double y = map.get("y");
        BigDecimal xTemp = new BigDecimal(x);
        BigDecimal yTemp = new BigDecimal(y);
        String tempX = xTemp.setScale(8,BigDecimal .ROUND_HALF_UP).toPlainString();
        String tempY = yTemp.setScale(10,BigDecimal .ROUND_HALF_UP).toPlainString();
        return "x="+tempX+"&y="+tempY;
    }

    private Map<String, Double> converter(double x, double y, double[] cE) {
        double xTemp = cE[0] + cE[1] * Math.abs(x);
        double cC = Math.abs(y) / cE[9];
        double yTemp = cE[2] + cE[3] * cC + cE[4] * cC * cC + cE[5] * cC * cC * cC + cE[6] * cC * cC * cC * cC + cE[7] * cC * cC * cC * cC * cC + cE[8] * cC * cC * cC * cC * cC * cC;
        xTemp *= (x < 0 ? -1 : 1);
        yTemp *= (y < 0 ? -1 : 1);
        Map<String, Double> location = new HashMap<>(4);
        BigDecimal tempX = new BigDecimal(xTemp);
        BigDecimal tempY = new BigDecimal(yTemp);
        xTemp = tempX.setScale(8, BigDecimal.ROUND_HALF_UP).doubleValue();
        yTemp = tempY.setScale(8, BigDecimal.ROUND_HALF_UP).doubleValue();
        location.put("x", xTemp);
        location.put("y", yTemp);
        return location;
    }

    private Double getLoop(Double lng, Integer min, Integer max) {
        while (lng > max) {
            lng -= max - min;
        }
        while (lng < min) {
            lng += max - min;
        }
        return lng;
    }

    private Double getRange(Double lat, Integer min, Integer max) {
        if (min != null) {
            lat = Math.max(lat, min);
        }
        if (max != null) {
            lat = Math.min(lat, max);
        }
        return lat;
    }
}

注意

wgs转bd09ll

亦可参考如下代码:

public class Wgs84ToBd09ll {

    static double x_PI = 3.14159265358979324 * 3000.0 / 180.0;
    static double PI = 3.1415926535897932384626;
    static double a = 6378245.0;
    static double ee = 0.00669342162296594323;

    /**
     * 百度坐标系 (BD-09) 与 火星坐标系 (GCJ-02)的转换
     * 即 百度 转 谷歌、高德
     * @param bd_lon
     * @param bd_lat
     * @returns {*[]}
     */
    private String  bd09togcj02(double bd_lon, double bd_lat){
        double x = bd_lon - 0.0065;
        double y = bd_lat - 0.006;
        double z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_PI);
        double theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_PI);
        double gg_lng = z * Math.cos(theta);
        double gg_lat = z * Math.sin(theta);
        // Point point=new Point(gg_lng, gg_lat);
        // return point;
        return gg_lng+","+gg_lat;
    }

    /**
     * 火星坐标系 (GCJ-02) 与百度坐标系 (BD-09) 的转换
     * 即谷歌、高德 转 百度
     * @param lng
     * @param lat
     * @returns {*[]}
     */
    private String gcj02tobd09(double lng, double lat){
        double z = Math.sqrt(lng * lng + lat * lat) + 0.00002 * Math.sin(lat * x_PI);
        double theta = Math.atan2(lat, lng) + 0.000003 * Math.cos(lng * x_PI);
        double bd_lng = z * Math.cos(theta) + 0.0065;
        double bd_lat = z * Math.sin(theta) + 0.006;
        //Point point=new Point(bd_lng, bd_lat);
        // return point;
        return bd_lng+","+bd_lat;
    };

    /**
     * WGS84转GCj02
     * @param lng
     * @param lat
     * @returns {*[]}
     */
    private String wgs84togcj02(double lng, double lat){
        double dlat = transformlat(lng - 105.0, lat - 35.0);
        double dlng = transformlng(lng - 105.0, lat - 35.0);
        double radlat = lat / 180.0 * PI;
        double magic = Math.sin(radlat);
        magic = 1 - ee * magic * magic;
        double sqrtmagic = Math.sqrt(magic);
        dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
        dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
        double mglat = lat + dlat;
        double mglng = lng + dlng;
        //Point point=new Point(mglng, mglat);
        // return point;
        return mglng+","+mglat;
    };

    /**
     * GCJ02 转换为 WGS84
     * @param lng
     * @param lat
     * @returns {*[]}
     */
    private String gcj02towgs84(double lng, double lat){
        double dlat = transformlat(lng - 105.0, lat - 35.0);
        double dlng = transformlng(lng - 105.0, lat - 35.0);
        double radlat = lat / 180.0 * PI;
        double magic = Math.sin(radlat);
        magic = 1 - ee * magic * magic;
        double sqrtmagic = Math.sqrt(magic);
        dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
        dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
        double mglat = lat + dlat;
        double mglng = lng + dlng;
        // Point point=new Point(mglng, mglat);
        // return point;
        return mglat+","+mglng;
    };

    /**
     * WGS84 转换为 BD-09
     * @param lng
     * @param lat
     * @returns {*[]}
     *
     */
    public String  wgs84tobd09(double lng, double lat){
        //第一次转换
        double dlat = transformlat(lng - 105.0, lat - 35.0);
        double dlng = transformlng(lng - 105.0, lat - 35.0);
        double radlat = lat / 180.0 * PI;
        double magic = Math.sin(radlat);
        magic = 1 - ee * magic * magic;
        double sqrtmagic = Math.sqrt(magic);
        dlat = (dlat * 180.0) / ((a * (1 - ee)) / (magic * sqrtmagic) * PI);
        dlng = (dlng * 180.0) / (a / sqrtmagic * Math.cos(radlat) * PI);
        double mglat = lat + dlat;
        double mglng = lng + dlng;

        //第二次转换
        double z = Math.sqrt(mglng * mglng + mglat * mglat) + 0.00002 * Math.sin(mglat * x_PI);
        double theta = Math.atan2(mglat, mglng) + 0.000003 * Math.cos(mglng * x_PI);
        double bd_lng = z * Math.cos(theta) + 0.0065;
        double bd_lat = z * Math.sin(theta) + 0.006;
        return bd_lng+","+bd_lat;
    }

    private double transformlat(double lng,double lat){
        double ret= -100.0 + 2.0 * lng + 3.0 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
        ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(lat * PI) + 40.0 * Math.sin(lat / 3.0 * PI)) * 2.0 / 3.0;
        ret += (160.0 * Math.sin(lat / 12.0 * PI) + 320 * Math.sin(lat * PI / 30.0)) * 2.0 / 3.0;
        return ret;
    }

    private double transformlng(double lng,double lat){
        double ret = 300.0 + lng + 2.0 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
        ret += (20.0 * Math.sin(6.0 * lng * PI) + 20.0 * Math.sin(2.0 * lng * PI)) * 2.0 / 3.0;
        ret += (20.0 * Math.sin(lng * PI) + 40.0 * Math.sin(lng / 3.0 * PI)) * 2.0 / 3.0;
        ret += (150.0 * Math.sin(lng / 12.0 * PI) + 300.0 * Math.sin(lng / 30.0 * PI)) * 2.0 / 3.0;
        return ret;
    }

}
百度坐标转换成WGS84坐标 需求:将百度坐标转换成WGS84坐标 实现: 首先介绍一下国内诸多繁杂的坐标系,众所周知,美国GPS使用的是WGS84坐标,但是在中国,国家出于安全的考虑,在地图发布和出版的时候,对84坐标进行了一次非线性加偏,得到的坐标我们称之为GCJ02坐标系,俗称火星坐标。另外,国内许多地图公司,可能是由于业务的需求,或者是商业竞争的某些原因,在火星坐标的基础上又进行了一次非线性加偏,得到 阅读详情

相关推荐

R语言 百度坐标转换至WGS84坐标

本文利用R语言封装了百度坐标转换至WGS84坐标的函数,亲测有效,提供了便捷的百度坐标转换方法。

qingchen98的博客 2136

POI百度火星坐标转换WGS84坐标,excel运行

高德或百度地图POI坐标,百度火星坐标转换WGS84坐标,程序运行,excel

Crescentmdl的博客 2104

火星百度坐标转WGS84坐标小工具

将国内POI数据坐标(百度或火星坐标)转为WGS84坐标工具(exe程序文件)

使用GIS数据转换器将百度坐标点转WGS-84

使用GIS数据转换器将百度坐标点转WGS-84

qq_26328861的博客 3632

深入解析STM32F40x CAN控制器的配置与优化

本文深入解析STM32F40x CAN控制器的配置与优化,涵盖基础工作模式、波特率计算、筛选器配置及中断管理等关键技术。通过实战案例和代码示例,帮助开发者高效配置CAN通信,提升工业控制系统的稳定性和性能。

weixin_26834815的博客 226

别再为GEE注册发愁了!用谷歌Cloud Project,5分钟搞定谷歌地球引擎账户(保姆级图文)

本文提供2024最新版谷歌地球引擎(GEE)账户注册的保姆级教程,通过谷歌Cloud Project快速完成注册,5分钟极速通关。详细解析注册前的准备、分步图解流程、常见误区及解决方案,帮助用户避开90%的注册陷阱,直达GEE核心功能区。

weixin_42557830的博客 202

百度坐标批量转换成WGS84坐标

百度坐标批量转换成WGS84坐标

qq_42213727的博客 3531

深入LSM6DSL的FIFO连续模式:基于STM32和MEMS库的数据流高效处理指南

本文深入探讨了LSM6DSL的FIFO连续模式,结合STM32硬件平台和ST官方MEMS库,提供了高效的数据流处理方案。通过优化I2C通信时序、中断驱动设计以及动态ODR调整,实现低功耗数据采集与处理,显著提升嵌入式传感器应用的性能和续航能力。

weixin_30387799的博客 351

百度坐标转WGS84(即GPS)坐标

        此坐标转换用的是GPSspg的API,如果您需要转几个的话还是在线转效率比较高;如果量比较大的话,转换不超过2000次/天,可以用此方法(免费);如果量很大的话,推荐订阅较高级的套餐。单个在线转换:地址:http://www.gpsspg.com/maps.htm参数说明:    GPS 坐标 / WGS84,适用于谷歌地球 Google Earth。     Google 坐标,...

走在bug的路上 5万+

解密QtIFW高级配置:用XML+JS打造品牌化安装界面(含动态水印/多语言技巧)

本文深入探讨了如何利用Qt Installer Framework(QtIFW)的高级配置功能,通过XML和JavaScript打造专业、品牌化的软件安装界面。文章详细解析了企业级项目目录结构设计、模块化配置文件编写、CSS样式表深度定制、动态水印实现以及智能多语言许可证管理等核心技巧,旨在帮助开发者超越基础打包,为Windows和Linux平台构建具有卓越用户体验的安装程序。

read5的博客 531

中国大学MOOC-翁恺-C语言程序设计习题集-解答汇总

中国大学MOOC-翁恺-C语言程序设计习题集 PAT 习题集 02-0. 整数四则运算(10) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 乔林(清华大学) 本题要求编写程序,计算2个正整数的和、差、积、商并输出。题目保证输入和输出全部在整型范围内。 输入格式: 输入在一行中给出2...

weixin_30691871的博客 3万+

WGS84转换为三大图商(百度、高德、腾讯)坐标,Gcj02转换为WGS84

WGS84转换为三大图商(百度、高德、腾讯)坐标,Gcj02转换为WGS84

weixin_51591287的博客 1万+

Polars简明基础教程一:Polars快速入门

在这个例子中,我们将添加一个列,其中包含每个舱位中乘客的最大年龄。在Python中(而不是特指Polars),当我们将代码包裹在括号中时,我们可以在新行上调用一个新方法——在这种情况下是select。在这里,我们看到一个使用表达式API的简单示例,其中我们在select语句中选择Pclass、Name和Age列(我们将在第3节中深入了解select语句)。表达式是一个函数,它接受一个Series(或DataFrame中的列)作为输入,并返回一个Series(或DataFrame中的列)。

sosogod的博客 3881

经纬度各坐标系之间转换

经纬度坐标系之间转换

搬运工 1681

Autosar结合simulink的汽车应用层软件开发实例

本文基于汽车应用开发案例,并结合Autosar相关知识,生成具有Autosar标准的汽车应用层开发代码,以供学习和参考。以上就是本篇内容,主要是利用Simulink创建Autosar接口并进行端口映射的方法。

m0_64899535的博客 2153

3.7 改造模型:为GPT添加一个分类头(Classification Head)

本文介绍如何改造GPT模型用于文本分类任务。主要内容包括: 分类头设计思路:GPT作为语言模型需要添加分类头才能适应分类任务,类似于为语言大师添加裁判功能。 序列表示选择策略: 分析三种常见方法(CLS标记、平均池化、最后词元表示) 推荐使用最后词元表示,因其最能反映GPT的单向信息流特性 代码实现: 构建GPT2ForSequenceClassification类 包含预训练GPT主体和线性分类头 使用attention_mask智能定位句子结尾 通过高级索引提取最后词元特征 该方法通过简单改造使GPT模

yonggeit的博客 2973

GIS数据格式坐标转换(地球坐标WGS84、GCJ-02、火星坐标、百度坐标BD-09、国家大地坐标系CGCS2000)

地理信息系统 (GIS) 是一个创建、管理、分析和绘制所有类型数据的系统。GIS 将数据连接到地图,将位置数据(事物所在位置)与所有类型的描述性信息(事物在该位置的情况)集成到一起。这可以为适用于自然科学和几乎所有行业的制图和分析提供基础。GIS 帮助用户了解模式、关系和地理环境。其优势包括改善沟通、提高效率以及更好地管理和决策。解决使用百度webAPI坐标转换时的问题:X→GPS根据法律规定,不支持将任何类型的坐标转换为GPS坐标;

挖掘大数据价值,让决策者快速洞悉趋势,让大众读懂数据背后的故事。 2万+

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

简谈百度坐标反转至WGS84的三种思路

文章版权由作者李晓晖和博客园共有,若转载请于明显处标明出处:http://www.cnblogs.com/naaoveGIS/ 1.背景 基于百度地图进行数据展示是目前项目中常见场景,但是因为百度地图是基于BD09坐标系的,GPS坐标(WGS84)或者其他常见的标准坐标是无法准确在地图上进行展示的,但是互联网在线情况下,百度提供了将WGS84经纬度转换成百度经纬度坐标的API,这里不再对其进行研究...

weixin_33672400的博客 1508

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

WGS84(GPS坐标) BD09坐标(百度坐标)GCJ02(国测局坐标、高德) 的相互转换

关于三种坐标系的介绍使用手机(如安卓)的默认GPS定位使用的是WGS84坐标系,百度地图使用的自家BD09LL坐标系,高德地图和腾讯地图都是GCJ02即火星坐标系,所以相互之间是需要转换的,不然会有位置偏移。

hhb442的博客 1万+

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

百度坐标转wgs84并计算距离

【代码】百度坐标转wgs84并计算距离。

m0_61395616的博客 411

百度火星坐标转wgs84

坐标系简介 我们获取数据一般常用两种地图的api,即高德地图和百度地图,而往往我通过api获取到的数据是不可以直接使用的,是因为他们的真实坐标系统进行人为的加偏处理,按照特殊的算法,将真实的坐标加密成虚假的坐标,而这个加偏并不是线性的加偏,所以各地的偏移情况都会有所不同。而加密后的坐标也常被人称为火星坐标系统。 WGS84坐标系 即地球坐标系,国际上通用的坐标系。 设备一般包含GPS芯片或者北斗芯片获取的经纬度为WGS84地理坐标系。谷歌地图采用的是WGS84地理坐标系(中国范围除...

Jasenjane的博客 4739

WGS84坐标系、Web墨卡托、GCJ02坐标系、BD09坐标系—常用坐标系简述

1,WGS84坐标 WGS84坐标系:即地球坐标系(World Geodetic System),国际上通用的坐标系。。设备包含的GPS芯片或者北斗芯片获取的经纬度一般都是为WGS84地理坐标系,目前谷歌地图采用的是WGS84坐标系(中国范围除外)。 WGS84Web 墨卡托投影坐标系:也称web墨卡托,是如今主流的Web地图使用的坐标系,如国外的 Google Maps,OpenStreetMap,Bing Map,ArcGIS 和 Heremaps 等,国内的百度地图、高德地图、...

左本Web3D 7668

如何实现wgs84(ep4326)坐标系与百度坐标系,火星坐标系的互转,java与JavaScript都有

国家规定:国内出版的各种地图系统(包括电子形式),必须至少采用GCJ-02对地理位置进行首次加密(高德地图、腾讯地图等);工作中用到百度地图和高德地图服务,必须实现转换就成了难题了,现在它来了,java后台和纯js方法都有,直接上代码。众所周知国内的地址服务不让直接用wgs84,百度使用的是百度坐标系,高德地图使用的是火星坐标系。国际地图提供商使用的坐标系(谷歌地图国外、osm、mapbox)。百度标准,百度 SDK,百度地图,百度GeoCoding 使用;2.国测局坐标系(GCJ-02、火星坐标系)

weixin_42759398的博客 1608

百度地图使用

百度地图使用备忘

ljg963419的博客 418

国内最常用的坐标系大全

WGS84坐标系(GPS坐标系) WGS-84坐标系(World Geodetic System一1984 Coordinate System)是一种国际上采用的地心坐标系。坐标原点为地球质心,其地心空间直角坐标系的Z轴指向BIH(国际时间服务机构)1984.0定义的协议地球极(CTP)方向,X轴指向BIH 1984.0的零子午面和CTP赤道的交点,Y轴与Z轴、X轴垂直构成右手坐标系,称为1984年世界大地坐标系统。 WGS-84原始坐标系,一般用国际GPS纪录仪记录下来的经纬度,通过GP...

振华OPPO的博客世界 8584
上一篇: Redis之zset常用命令及好友关系设置简易实现札记
下一篇: Mybatis动态sql语句及模糊查询札记
zhg_vincent
博客等级 码龄12年 93粉丝 45原创
评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值