Figure API coordinate systems around the relatively

Figure API coordinate systems around the relatively

Simply record what various coordinate systems

  • WGS84 coordinate system: the earth coordinate system, a common coordinate system in the world. Device generally includes a GPS chip or chips Compass acquired latitude and longitude WGS84 geographic coordinate system, Google Maps uses a WGS84 geographic coordinate system (excluding China range);
  • GCJ02 coordinate system: the Mars coordinate system, the WGS84 coordinate system by the coordinate system of encryption, is developed by China National Mapping Bureau of GIS coordinate system, and requested must be encrypted China use map products used after coordinate of. Google map of China and China Soso map uses GCJ02 geographic coordinate system;
  • BD09 coordinate system: the coordinate system Baidu i.e., GCJ02 coordinate system by the coordinate system encrypted, the official explanation is to further protect the privacy of users;
  • Sogou coordinate system, map coordinates, etc. it is also estimated by encrypting the GCJ02 basis.

Calculate the distance between two points java

  private static final double EARTH_RADIUS = 6378.137;
  
  public static double calculateDistance(
      double longitude1, double latitude1, double longitude2, double latitude2) {
    double radLat1 = rad(latitude1);
    double radLat2 = rad(latitude2);
    double diffLat = radLat1 - radLat2;
    double diffLon = rad(longitude2) - rad(longitude1);
    double s =
        2
            * Math.asin(
                Math.sqrt(
                    Math.pow(Math.sin(diffLat / 2), 2)
                        + Math.cos(radLat1)
                            * Math.cos(radLat2)
                            * Math.pow(Math.sin(diffLon / 2), 2)));
    s = s * EARTH_RADIUS * 1000;
    return s;
  }

  private static double rad(double d) {
    return d * Math.PI / 180.0;
  }

Guess you like

Origin www.cnblogs.com/supercj/p/10945641.html