精华内容
下载资源
问答
  • WGS84 与 UTM 互转(Python代码版)

    千次阅读 2021-07-19 17:37:53
    本文不讲原理,只分享实践思路和代码。基于Python语言,使用pyproj库进行WGS 和UTM的转换。

    前言

    本文不讲原理,只分享实践思路和代码。基于Python语言,使用pyproj库进行WGS 和UTM的转换。

    目录

    一、安装pyproj

    二、WGS84 转 UTM-示例代码

    三、UTM 转 WGS84-示例代码

    四、算法效率

    三、查询坐标系WKID

    四、pyproj官网文档学习


    一、安装pyproj

    pip install pyproj

    二、WGS84 转 UTM-示例代码

    '''
    WGS84的经纬度 转 UTM的x,y
    '''
    from pyproj import Transformer
    
    
    # 参数1:WGS84地理坐标系统 对应 4326 
    # 参数2:坐标系WKID 广州市 WGS_1984_UTM_Zone_49N 对应 32649
    transformer = Transformer.from_crs("epsg:4326", "epsg:32649") 
    
    lat = 22.744435950
    lon = 113.595417400
    x, y = transformer.transform(lat, lon)
    print("x:", x, "y:", y)
    

    输出结果:

    x: 766544.7801555358  y: 2517564.4969607797

    对比结果精准性,Apollo6.0代码转换的结果:

    三、UTM 转 WGS84-示例代码

    '''
    UTM的x,y 转 WGS84的经纬度
    '''
    from pyproj import Transformer
    
    # 参数1:坐标系WKID 广州市 WGS_1984_UTM_Zone_49N 对应 32649
    # 参数2:WGS84地理坐标系统 对应 4326
    transformer = Transformer.from_crs("epsg:32649", "epsg:4326")
    
    x = 766544.7801555358
    y = 2517564.4969607797
    lat, lon = transformer.transform(x, y)
    print("x:", x, "y:", y)
    print("lat:", lat, "lon:", lon)
    

    输出:x: 766544.7801555358           y: 2517564.4969607797
              lat: 22.744435950000007        lon: 113.5954174

    四、算法效率

    这里计算1s内,能运行多少次转换,以UTM 转 WGS84为例子。

    '''
    计算1s内,能运行多少次转换(UTM的x,y 转 WGS84的经纬度)
    '''
    from pyproj import Transformer
    import time
    # 参数1:坐标系WKID 广州市 WGS_1984_UTM_Zone_49N 对应 32649
    # 参数2:WGS84地理坐标系统 对应 4326
    transformer = Transformer.from_crs("epsg:32649", "epsg:4326")
    
    sum_t=0.0            #花费的总时间
    i = 0
    
    # 计算1s内,能运行多少次转换。
    while sum_t < 1:
        time_start = time.time()  # 开始计时
        print("i:", i)
        i = i + 1
        ###########
        x = 766544.7801555358
        y = 2517564.4969607797
        lat, lon = transformer.transform(x, y)
        print("x:", x, "y:", y)
        print("lat:", lat, "lon:", lon)
        ###########
        time_end = time.time()                # 结束计时
        sum_t=(time_end - time_start)+sum_t   #运行所花时间
        print('time cost', sum_t, 's')
        print("\n")

    这是我电脑的结果,1s能转换2489次左右。

    三、查询坐标系WKID

    可以从以下两个网站进行查询:

    地理坐标系WKID:https://developers.arcgis.com/javascript/3/jshelp/gcs.htm

    投影坐标系WKID:https://developers.arcgis.com/javascript/3/jshelp/pcs.htm

    比如,查询广州市的,先查广州市的UTM区号WGS_1984_UTM_Zone_49N;然后在官方网页,用Ctrl + F搜索一下,能找到WGS_1984_UTM_Zone_49N 对应 32649

    四、pyproj官网文档学习

    https://www.osgeo.cn/pyproj/examples.html

    参考:https://blog.csdn.net/tap880507/article/details/111608529

    UTM坐标和WGS84坐标(如何转换?

    https://blog.csdn.net/ywcpig/article/details/107516253

    本文只提供参考学习,谢谢。

    展开全文
  • Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious.解决方案I ...

    Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious.

    解决方案

    I was able to use Geotools 2.4 to get something that works, based on some example code.

    double utmZoneCenterLongitude = ... // Center lon of zone, example: zone 10 = -123

    int zoneNumber = ... // zone number, example: 10

    double latitude, longitude = ... // lat, lon in degrees

    MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);

    ReferencingFactoryContainer factories = new ReferencingFactoryContainer(null);

    GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;

    CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;

    ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");

    parameters.parameter("central_meridian").setValue(utmZoneCenterLongitude);

    parameters.parameter("latitude_of_origin").setValue(0.0);

    parameters.parameter("scale_factor").setValue(0.9996);

    parameters.parameter("false_easting").setValue(500000.0);

    parameters.parameter("false_northing").setValue(0.0);

    Map properties = Collections.singletonMap("name", "WGS 84 / UTM Zone " + zoneNumber);

    ProjectedCRS projCRS = factories.createProjectedCRS(properties, geoCRS, null, parameters, cartCS);

    MathTransform transform = CRS.findMathTransform(geoCRS, projCRS);

    double[] dest = new double[2];

    transform.transform(new double[] {longitude, latitude}, 0, dest, 0, 1);

    int easting = (int)Math.round(dest[0]);

    int northing = (int)Math.round(dest[1]);

    展开全文
  • Java 经纬度转UTM投影

    2021-01-14 22:17:33
    java 经纬度转UTM投影 public class UtmConvert { /* Ellipsoid model constants (actual values here are for WGS84) */ static double sm_a = 6378137.0; static double sm_b = 6356752.314; static double sm_...

    java 经纬度转UTM投影

    public class UtmConvert {

    /* Ellipsoid model constants (actual values here are for WGS84) */
    static double sm_a = 6378137.0;
    static double sm_b = 6356752.314;
    static double sm_EccSquared = 6.69437999013e-03;
    
    static double UTMScaleFactor = 0.9996;
    
    
    public static double DegToRad(double deg) {
    	return (deg / 180.0 * Math.PI);
    }
    
    
    public static double RadToDeg(double rad) {
    	return (rad / Math.PI * 180.0);
    }
    
    public static double ArcLengthOfMeridian(double phi) {
    	double alpha, beta, gamma, delta, epsilon, n;
    	double result;
    
    	n = (sm_a - sm_b) / (sm_a + sm_b);
    
    	alpha = ((sm_a + sm_b) / 2.0)
    			* (1.0 + (Math.pow(n, 2.0) / 4.0) + (Math.pow(n, 4.0) / 64.0));
    
    	beta = (-3.0 * n / 2.0) + (9.0 * Math.pow(n, 3.0) / 16.0)
    			+ (-3.0 * Math.pow(n, 5.0) / 32.0);
    
    	gamma = (15.0 * Math.pow(n, 2.0) / 16.0)
    			+ (-15.0 * Math.pow(n, 4.0) / 32.0);
    
    
    	delta = (-35.0 * Math.pow(n, 3.0) / 48.0)
    			+ (105.0 * Math.pow(n, 5.0) / 256.0);
    
    
    	epsilon = (315.0 * Math.pow(n, 4.0) / 512.0);
    
    	result = alpha
    			* (phi + (beta * Math.sin(2.0 * phi))
    					+ (gamma * Math.sin(4.0 * phi))
    					+ (delta * Math.sin(6.0 * phi)) + (epsilon * Math
    					.sin(8.0 * phi)));
    
    	return result;
    }
    
    public static double UTMCentralMeridian(int zone) {
    	double cmeridian;
    
    	cmeridian = DegToRad(-183.0 + (zone * 6.0));
    
    	return cmeridian;
    }
    
    public static double FootpointLatitude(double y) {
    	double y_, alpha_, beta_, gamma_, delta_, epsilon_, n;
    	double result;
    
    	n = (sm_a - sm_b) / (sm_a + sm_b);
    
    	
    	alpha_ = ((sm_a + sm_b) / 2.0)
    			* (1 + (Math.pow(n, 2.0) / 4) + (Math.pow(n, 4.0) / 64));
    
    
    	y_ = y / alpha_;
    
    	
    	beta_ = (3.0 * n / 2.0) + (-27.0 * Math.pow(n, 3.0) / 32.0)
    			+ (269.0 * Math.pow(n, 5.0) / 512.0);
    
    
    	gamma_ = (21.0 * Math.pow(n, 2.0) / 16.0)
    			+ (-55.0 * Math.pow(n, 4.0) / 32.0);
    			+ 
    	delta_ = (151.0 * Math.pow(n, 3.0) / 96.0)
    			+ (-417.0 * Math.pow(n, 5.0) / 128.0);
    
    	epsilon_ = (1097.0 * Math.pow(n, 4.0) / 512.0);
    
    	result = y_ + (beta_ * Math.sin(2.0 * y_))
    			+ (gamma_ * Math.sin(4.0 * y_)) + (delta_ * Math.sin(6.0 * y_))
    			+ (epsilon_ * Math.sin(8.0 * y_));
    
    	return result;
    }
    
    public static void MapLatLonToXY(double phi, double lambda, double lambda0,
    		double[] xy) {
    	double N, nu2, ep2, t, t2, l;
    	double l3coef, l4coef, l5coef, l6coef, l7coef, l8coef;
    	//double tmp;
    
    	/* Precalculate ep2 */
    	ep2 = (Math.pow(sm_a, 2.0) - Math.pow(sm_b, 2.0)) / Math.pow(sm_b, 2.0);
    
    	/* Precalculate nu2 */
    	nu2 = ep2 * Math.pow(Math.cos(phi), 2.0);
    
    	/* Precalculate N */
    	N = Math.pow(sm_a, 2.0) / (sm_b * Math.sqrt(1 + nu2));
    
    	/* Precalculate t */
    	t = Math.tan(phi);
    	t2 = t * t;
    	//tmp = (t2 * t2 * t2) - Math.pow(t, 6.0);
    
    	/* Precalculate l */
    	l = lambda - lambda0;
    
    	/*
    	 * Precalculate coefficients for ln in the equations below so a normal
    	 * human being can read the expressions for easting and northing -- l1
    	 * and l2 have coefficients of 1.0
    	 */
    	l3coef = 1.0 - t2 + nu2;
    
    	l4coef = 5.0 - t2 + 9 * nu2 + 4.0 * (nu2 * nu2);
    
    	l5coef = 5.0 - 18.0 * t2 + (t2 * t2) + 14.0 * nu2 - 58.0 * t2 * nu2;
    
    	l6coef = 61.0 - 58.0 * t2 + (t2 * t2) + 270.0 * nu2 - 330.0 * t2 * nu2;
    
    	l7coef = 61.0 - 479.0 * t2 + 179.0 * (t2 * t2) - (t2 * t2 * t2);
    
    	l8coef = 1385.0 - 3111.0 * t2 + 543.0 * (t2 * t2) - (t2 * t2 * t2);
    
    	/* Calculate easting (x) */
    	xy[0] = N
    			* Math.cos(phi)
    			* l
    			+ (N / 6.0 * Math.pow(Math.cos(phi), 3.0) * l3coef * Math.pow(
    					l, 3.0))
    			+ (N / 120.0 * Math.pow(Math.cos(phi), 5.0) * l5coef * Math
    					.pow(l, 5.0))
    			+ (N / 5040.0 * Math.pow(Math.cos(phi), 7.0) * l7coef * Math
    					.pow(l, 7.0));
    
    	/* Calculate northing (y) */
    	xy[1] = ArcLengthOfMeridian(phi)
    			+ (t / 2.0 * N * Math.pow(Math.cos(phi), 2.0) * Math
    					.pow(l, 2.0))
    			+ (t / 24.0 * N * Math.pow(Math.cos(phi), 4.0) * l4coef * Math
    					.pow(l, 4.0))
    			+ (t / 720.0 * N * Math.pow(Math.cos(phi), 6.0) * l6coef * Math
    					.pow(l, 6.0))
    			+ (t / 40320.0 * N * Math.pow(Math.cos(phi), 8.0) * l8coef * Math
    					.pow(l, 8.0));
    
    	return;
    }
    
    public static void MapXYToLatLon(double x, double y, double lambda0,
    		double[] philambda) {
    	double phif, Nf, Nfpow, nuf2, ep2, tf, tf2, tf4, cf;
    	double x1frac, x2frac, x3frac, x4frac, x5frac, x6frac, x7frac, x8frac;
    	double x2poly, x3poly, x4poly, x5poly, x6poly, x7poly, x8poly;
    
    	/* Get the value of phif, the footpoint latitude. */
    	phif = FootpointLatitude(y);
    
    	/* Precalculate ep2 */
    	ep2 = (Math.pow(sm_a, 2.0) - Math.pow(sm_b, 2.0)) / Math.pow(sm_b, 2.0);
    
    	/* Precalculate cos (phif) */
    	cf = Math.cos(phif);
    
    	/* Precalculate nuf2 */
    	nuf2 = ep2 * Math.pow(cf, 2.0);
    
    	/* Precalculate Nf and initialize Nfpow */
    	Nf = Math.pow(sm_a, 2.0) / (sm_b * Math.sqrt(1 + nuf2));
    	Nfpow = Nf;
    
    	/* Precalculate tf */
    	tf = Math.tan(phif);
    	tf2 = tf * tf;
    	tf4 = tf2 * tf2;
    
    	/*
    	 * Precalculate fractional coefficients for xn in the equations below to
    	 * simplify the expressions for latitude and longitude.
    	 */
    	x1frac = 1.0 / (Nfpow * cf);
    
    	Nfpow *= Nf; /* now equals Nf2) */
    	x2frac = tf / (2.0 * Nfpow);
    
    	Nfpow *= Nf; /* now equals Nf3) */
    	x3frac = 1.0 / (6.0 * Nfpow * cf);
    
    	Nfpow *= Nf; /* now equals Nf4) */
    	x4frac = tf / (24.0 * Nfpow);
    
    	Nfpow *= Nf; /* now equals Nf5) */
    	x5frac = 1.0 / (120.0 * Nfpow * cf);
    
    	Nfpow *= Nf; /* now equals Nf6) */
    	x6frac = tf / (720.0 * Nfpow);
    
    	Nfpow *= Nf; /* now equals Nf7) */
    	x7frac = 1.0 / (5040.0 * Nfpow * cf);
    
    	Nfpow *= Nf; /* now equals Nf8) */
    	x8frac = tf / (40320.0 * Nfpow);
    
    	x2poly = -1.0 - nuf2;
    
    	x3poly = -1.0 - 2 * tf2 - nuf2;
    
    	x4poly = 5.0 + 3.0 * tf2 + 6.0 * nuf2 - 6.0 * tf2 * nuf2 - 3.0
    			* (nuf2 * nuf2) - 9.0 * tf2 * (nuf2 * nuf2);
    
    	x5poly = 5.0 + 28.0 * tf2 + 24.0 * tf4 + 6.0 * nuf2 + 8.0 * tf2 * nuf2;
    
    	x6poly = -61.0 - 90.0 * tf2 - 45.0 * tf4 - 107.0 * nuf2 + 162.0 * tf2
    			* nuf2;
    
    	x7poly = -61.0 - 662.0 * tf2 - 1320.0 * tf4 - 720.0 * (tf4 * tf2);
    
    	x8poly = 1385.0 + 3633.0 * tf2 + 4095.0 * tf4 + 1575 * (tf4 * tf2);
    
    	philambda[0] = phif + x2frac * x2poly * (x * x) + x4frac * x4poly
    			* Math.pow(x, 4.0) + x6frac * x6poly * Math.pow(x, 6.0)
    			+ x8frac * x8poly * Math.pow(x, 8.0);
    
    	philambda[1] = lambda0 + x1frac * x + x3frac * x3poly
    			* Math.pow(x, 3.0) + x5frac * x5poly * Math.pow(x, 5.0)
    			+ x7frac * x7poly * Math.pow(x, 7.0);
    
    }
    
    public static double[] getBounds(double[] xy1, double[] xy2)
    		throws Exception {
    	double[] utm1 = GeoConvert.toUtm(xy1[0], xy1[1]);
    	
    	double[] utm2 = GeoConvert.toUtm(xy2[0], xy2[1]);
    
    	double[] utmBounds = { Math.abs(utm1[0] - utm2[0]),
    			Math.abs(utm1[1] - utm2[1]) };
    
    	return utmBounds;
    }
    
    public static int[] getPos(double lon, double lat, double[] xy1,
    		double[] xy2, int height, int width) throws Exception {
    	double[] utmPoint = GeoConvert.toUtm(lat, lon);
    
    	double[] utmBounds = getBounds(xy1, xy2);
    
    	double[] utmXy2 = GeoConvert.toUtm(xy2[0], xy2[1]);
    
    	double pdiffX = (utmXy2[0] - utmPoint[0]) / utmBounds[0];
    	double pdiffY = (1 - (utmXy2[1] - utmPoint[1]) / utmBounds[1]);
    
    	int[] xy = { 0, 0 };
    	xy[0] = (int) ((height * pdiffY) / 2) + 300;
    	xy[1] = (int) ((width * pdiffX) / 2) + 300;
    
    	return xy;
    }
    
    public static int LatLonToUTMXY(double lat, double lon, int zone,
    		double[] xy) {
    	MapLatLonToXY(lat, lon, UTMCentralMeridian(zone), xy);
    	xy[0] = xy[0] * UTMScaleFactor + 500000.0;
    	xy[1] = xy[1] * UTMScaleFactor;
    	if (xy[1] < 0.0)
    		xy[1] = xy[1] + 10000000.0;
    
    	return zone;
    }
    
    
    public static void UTMXYToLatLon(double x, double y, int zone,
    		boolean southhemi, double[] latlon) {
    	double cmeridian;
    
    	x -= 500000.0;
    	x /= UTMScaleFactor;
    
    	if (southhemi)
    		y -= 10000000.0;
    
    	y /= UTMScaleFactor;
    
    	cmeridian = UTMCentralMeridian(zone);
    	MapXYToLatLon(x, y, cmeridian, latlon);
    
    	return;
    }
    
    public static double[] toUtm(double lon, double lat) throws Exception {
    	double[] xy = { 0, 0 };
    
    	if ((lon < -180.0) || (180.0 <= lon)) {
    		throw new Exception("The longitude you entered is out of range.  "
    				+ "Please enter a number in the range [-180, 180).");
    
    	}
    
    	if ((lat < -90.0) || (90.0 < lat)) {
    		throw new Exception("The latitude you entered is out of range.  "
    				+ "Please enter a number in the range [-90, 90].");
    
    	}
    
    	// Compute the UTM zone.
    	int zone = (int) Math.floor((lon + 180.0) / 6) + 1;
    
    	zone = LatLonToUTMXY(DegToRad(lat), DegToRad(lon), zone, xy);
    
    	// System.out.println("X:" + xy[0]);
    	// System.out.println("Y:" + xy[1]);
    	// System.out.println("Zone:" + zone);
    
    	return xy;
    	// if (lat < 0)
    	// // Set the S button.
    	// document.frmConverter.rbtnHemisphere[1].checked = true;
    	// else
    	// // Set the N button.
    	// document.frmConverter.rbtnHemisphere[0].checked = true;
    
    }
    
    public static String toMGRS(double lon, double lat) throws Exception {
    	
    	double[] xy = toUtm(lon, lat);
    	
    	String[][] eastings = {
    			{"S", "T", "U", "V", "W", "X", "Y", "Z"},
    			{"A", "B", "C", "D", "E", "F", "G", "H"},
    			{"J", "K", "L", "M", "N", "P", "Q", "R"}
    	};
    	
    	String [] northings = {"A", "B", "C", "D", "E", "F", "G",
    							"H", "J", "K", "L", "M", "N", "P",
    							"Q", "R", "S", "T", "U", "V"};
    	
    	int zone = (int) Math.floor((lon + 180.0) / 6) + 1;
    	boolean zoneIsEven = (zone % 2) == 0;
    	String band = getZoneBand(lat);
    	
    	String x = String.format("%6s", String.valueOf(Math.round(xy[0]))).replaceAll(" ", "0");
    	String y = String.format("%7s", String.valueOf(Math.round(xy[1]))).replaceAll(" ", "0");
    	
    	String easting = eastings[zone % 3][Integer.parseInt(x.substring(0,1)) - 1];
    	String northing = northings[((Integer.parseInt(y.substring(0,2))  + (zoneIsEven ? 5 : 0)) % 20)];
    	
    	return zone + band + " " + easting + northing + " " + x.substring(1,6) + " " + y.substring(2,7);
    }
    
    public static String getZoneBand(double lat) throws Exception {
    	
    	String [] bands = {"C", "D", "E", "F", "G", "H", "J",
    						"K", "L", "M", "N", "P", "Q", "R",
    						"S", "T", "U", "V", "W"};
    	
    	if(lat >= -80.0 && lat < 72.0) {
    		return bands[((int) lat + 80) / 8];
    	}
    	else if(lat >= 72.0 && lat < 84.0) {
    		return "X";
    	}
    	else
    		throw new Exception("Latitude must be between -80 and +84");
    }
    

    }

    单元测试:
    import static org.junit.Assert.assertEquals;

    public classUtmConvertTest {

    public void testConvertToUTM() throws Exception {
    
    	double[] utm = UtmoConvert.toUtm(48.188767, 16.418349);
    	assertEquals(199753.6610440401, utm[0], 0);
    	assertEquals(1817294.8635275129, utm[1], 0);
    	System.out.println("X: " + utm[0]);
    	System.out.println("X: " + utm[1]);
    }
    

    }

    展开全文
  • 项目中用到经纬度相互转换,自己写感觉太麻烦,查询后发现...//经纬度转utm坐标int convert_lonlat_utm(const new3s_PointXYZ &lon_lat_coord, new3s_PointXYZ &utm_coord){OGRSpatialReference *RefSource ...

    项目中用到经纬度相互转换,自己写感觉太麻烦,查询后发现利用geos和proj4可以完成坐标转换,现在记录一下方便以后自己查询。

    //经纬度转utm坐标

    int convert_lonlat_utm(const new3s_PointXYZ &lon_lat_coord, new3s_PointXYZ &utm_coord)

    {

    OGRSpatialReference *RefSource = new OGRSpatialReference;

    RefSource->SetWellKnownGeogCS("WGS84");

    OGRSpatialReference *RefTarget = new OGRSpatialReference;

    RefTarget = RefSource->CloneGeogCS();

    int utmzone = lon_lat_coord.get_x() / 6 + 31;

    RefTarget->SetProjCS("UTM(WGS84) in northern hemisphere.");

    RefTarget->SetUTM(utmzone, TRUE);

    OGRCoordinateTransformation *poTransform = OGRCreateCoordinateTransformation(RefSource, RefTarget);

    double tempX = lon_lat_coord.get_x();

    double tempY = lon_lat_coord.get_y();

    double tempZ = lon_lat_coord.get_z();

    poTransform->Transform(1, &tempX, &tempY, &tempZ);

    utm_coord.set_x(tempX);

    utm_coord.set_y(tempY);

    utm_coord.set_z(tempZ);

    return utmzone;

    }

    这里返回的是条带数,因为在下面UTM坐标转经纬度的时需要条带数。

    //utm转经纬度

    void convert_utm_lonlat(const new3s_PointXYZ &utm_coord, const int &utmzone, new3s_PointXYZ &lon_lat_coord)

    {

    //建立投影坐标系到经纬度坐标系的转换

    OGRSpatialReference *RefSource = new OGRSpatialReference;

    RefSource->SetWellKnownGeogCS("WGS84");

    RefSource->SetProjCS("UTM(WGS84) in northern hemisphere.");

    RefSource->SetUTM(utmzone, TRUE);

    OGRSpatialReference *RefTarget = new OGRSpatialReference;

    RefTarget = RefSource->CloneGeogCS();

    OGRCoordinateTransformation *poTranform = OGRCreateCoordinateTransformation(RefSource, RefTarget);

    OGRPoint *poPoint = new OGRPoint();

    double tempx = utm_coord.get_x();

    double tempy = utm_coord.get_y();

    double tempz = utm_coord.get_z();

    poTranform->Transform(1, &tempx, &tempy, NULL);

    lon_lat_coord = new3s_PointXYZ(tempx, tempy, tempz);

    }

    展开全文
  • UTM大地坐标系与经纬度转换算法C++

    千次阅读 2021-05-24 19:54:47
    UTM坐标系,需要确定给定UTM区域的中央子午线。 分为三分度和六分度。 三分度 3度带:中央子午线计算公式:中央子午线L=3 ×N 。N=当地经度/3,N值进行四舍五入后即为3度带的带号。 六分度 6度带:中央子午线计算...
  • Java中关于UTM转经纬度

    2021-04-16 10:15:23
    最近接到需求,C#端会把UTM**坐标以及时区**传过来,需要Java端把数据转成对应的经纬度坐标。 关于UTM的相关知识:[http://dmap.co.uk/utmworld.htm](http://dmap.co.uk/utmworld.htm) 解决方案: 参考地址:...
  • 使用pyproj进行WGS 1984和UTM的转换

    千次阅读 2020-12-24 10:38:26
    计算所在utm区域 116/6 =19.333333333333332 19+31 =50 from pyproj import Transformer transformer = Transformer.from_crs("epsg:4326", "epsg:32650") lat = 40.0691643333333 lon = 116.242161333333 x3, ...
  • c#代码 utm坐标转换经纬度坐标 根据地球半径计算经纬度 public static void UTMToLatLon(double utmX, double utmY, out double latitude, out double longitude) { bool isNorthHemisphere = true; var diflat ...
  • Python-UTM坐标与经纬度(WGS84)坐标转换

    千次阅读 2021-02-03 01:23:14
    可以从以下两个网站进行查询: 实现坐标变换 utm_x, utm_y = transformer.transform(30.90786255,121.84786891) print("utm_x:{}, utm_y:{}".format(utm_x, utm_y)) 完整的转换代码如下: from pyproj import ...
  • 今天要给大家介绍这款真的可以在iOS设备上安装安卓/ Windows / Linux 系统的神器「UTM」虚拟机。「UTM」类似于 Windows 上的「VMWare」虚拟机软件一样可以安装不同的操作系统。要知道iOS是封闭性系统,现在可以在...
  • 1. 代码如下 from pyproj import Transformer import pyproj import json from matplotlib.pyplot import * if __name__ == '__main__': # 使用json包读取json文件得到GPS经纬度数据 gps_file = open('gps....
  • 什么是 UTM UTM (URL tracking mark) 指自定义链接跟踪标识,是用于跟踪链接来源、媒介、关键词、内容、名称等信息的标识。美洽可以采集和统计对话着陆页的 UTM 信息,只需在广告投放或其他第三方跳转过程中,将 UTM...
  • 本文主要实现的是利用python的serial库,通过串口读取组合惯导的相关数据并解析,然后将经纬度高程坐标转换为当地的北东天坐标系和utm坐标系。 组合惯导简介 组合惯导融合了卫星定位系统和基于陀螺仪的定位定向...
  • 本文代码实现基本按照《数据结构》课本目录顺序,外加大量的复杂算法实现,一篇文章足够。能换你一个收藏了吧?
  • DDD下的代码文档生成

    2021-09-24 17:55:48
    目前低代码生成领域非常火爆,而且市场价值在逐步上升,很多巨头都在重金投入。低代码的出现意味着程序员可以从大量重复低效的劳动中脱离出来,同时可以更好更快的支持业务解决实际问题,极大的提高了交付价值的效率...
  • https://jingyan.baidu.com/article/1974b289a506dbf4b1f77406.html canonical标签... 另外,建议不要使用301进行跳转,有可能会造成跟踪代码的失效,如果受访页面被统计为301跳转后的页面,那么跟踪代码就毫无意义了。
  • 二、git pull upstream develop 拉取最新代码 三、git stash pop 把暂存区中当前最新暂存取出,并删除暂存区列表中的当前最新暂存 参考博客:https://www.shangmayuan.com/a/38d0c981f98e406192c507e6.html ...
  • 这篇这篇文章将带大家学习安天科技集团首席架构师肖新光老师(Seak)的分享,介绍恶意代码与APT攻击中的武器,包括A2PT的攻击武器、普通APT组织的自研恶意代码、商用恶意代码、无恶意代码作业、开源和免费工具等。...
  • 代码评审如何做好

    2021-02-20 09:14:51
    这篇 wiki 介绍说 Code Review 在帮助团队找到代码缺陷这件事上作用巨大:“代码审查一般可以找到及移除约65%的错误,最高可以到85%”。实际上, Code Review 的好处远不止这一条,它至少能在以下三个方面帮到我们:...
  • 这里写目录标题Word文档添加伪代码(Aurora插件) Word文档添加伪代码(Aurora插件) 1.先下载MiKTex 官网地址 https://miktex.org/download 安装步骤可以看官网的指导 https://miktex.org/howto/install-miktex 2....
  • 输出helloworld代码: #FileName: HelloWorld.java public class HelloWorld #如果有 public 类的话,类名必须和文件同名,注意大小写 { #Java 入口程序,程序从此入口 public static void main(String[] args) { #...
  • cd ../../ 数据集ADE20K准备 下载地址:https://gas.graviti.cn/dataset/shannont/ADE20K?utm_medium=0728datawhale 数据规模: 训练集:25574;验证集:2K;测试集:3K 内容:365个场景;3688个类别。 ADE20K 的...
  • 当我试图通过使用anaconda中的可用库将degree decimal坐标转换为utm时,我很惊讶utm.我的坐标看起来像:lon = array([83.71666667, 83.7 , 83.6 , 83.65 , 83.6 ,83.88333333, 83.56666667, 83.88333333, 83.96666667,...
  • 本文介绍了python技能之导出excel的实例代码,正好能用到,写出来分享给大家作为一个数据分析师,下面的需求是经常会遇到的。从数据库或者现有的文本文件中提取符合要求的数据,做一个二次处理,处理完成后的数据...
  • 代码下载: 一、抖音爬取教程 1、获取抖音博主个人url 手机打开小杨哥的抖音主页,右上角打开【…】----【分享】----【复制链接】 如下图: 我们复制出来的链接是这样的(这是短连接,每次复制出来的都不一样):...
  • R语言实践代码汇总

    2020-12-30 14:28:21
    持续更新一波最近遇到的R语言实践过程中的问题。竖着生成一列data frame并把生产的值传给另一个data frame的一列IDlabellabel1IDlabellabel2data.labeldata.labelx$label = data.label$label2. 给data frame重新命名...
  • 通过selenium实现企业信用代码批量获取
  • 摘自:...depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-1.con
  • iOS问题:出现崩溃问题,崩溃定位在汇编而不是具体代码 项目场景: 做一个软件,当接收到较大图片时,软件就会崩溃退出。而且定位在汇编,而不是以往的代码。 ![在这里插入图片描述]...
  • 记录几段常用的图像处理python代码 均非原创,基本都是把网上代码修修改改,增加了批处理等输入输出 图像叠加 将某目录下两张命名一致的jpg和png图像按照一定权重叠加,叠加后图片输出在当前目录下 import cv2 ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 42,326
精华内容 16,930
关键字:

utm代码