如何在Python中将UTM转换为纬度/经度? [英] How to convert the UTM to Lat/Long in Python?

查看:146
本文介绍了如何在Python中将UTM转换为纬度/经度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{
  "type": "MultiPolygon",
  "coordinates": [[[
        [6707794.77817316, 1952512.97762237],
        [6707794.43138905, 1952566.21209599],
        [6707897.49942442, 1952567.26754007],
        [6707897.9039513, 1952513.5347079],
        [6707794.77817316, 1952512.97762237]
      ]]]
}

这些是我对萨克拉曼多市的UTM坐标

these are my UTM coordinates for Sacramento city

from pyproj import Proj
Lat = 52.063098675
Lon = -114.132980348
ZoneNo = "11" #Manually input or from other sources
myProj = Proj("+proj=utm +zone="+\
ZoneNo+", +north +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
Lon2, Lat2 = myProj(UTMx, UTMy,inverse=True)



 [57.645243963689346, -97.82662155895939][57.64521883657446, 
-97.82633467103226][57.64520287229081, -97.82615238782866] 
[57.64518564728056, -97.82595574421379][57.646086991794625, 
-97.82587777819731][57.64614690939316, -97.8265560026529] 
[57.645243963689346, -97.82662155895939]

但是此返回坐标位于加拿大.但是我想在萨克拉曼多市找到这个纵向和横向的地方

But this return coordinates located at Canada. But I want to Locate this longitudinal and latitudinal's in SACRAMENTO city

谁能帮助我转换正确的格式,以将UTM转换为LAN LONG坐标.

Can anyone help me to convert the correct format to convert the UTM to LAN LONG coordinates.

推荐答案

您的坐标正在使用"NAD83(NSRS2007)/加利福尼亚2区(ftUS)" 坐标系:

Your coordinates are using the "NAD83(NSRS2007) / California zone 2 (ftUS)" coordinate system:

from django.contrib.gis.geos import Polygon
from pprint import pprint

DATA = [
    [6707794.77817316, 1952512.97762237],
    [6707794.43138905, 1952566.21209599],
    [6707897.49942442, 1952567.26754007],
    [6707897.9039513, 1952513.5347079],
    [6707794.77817316, 1952512.97762237]
]

poly_california = Polygon(DATA, srid=3492)
poly_gps = poly_california.transform(4326, clone=True)
pprint(poly_gps.coords)

结果:

(((-121.48923204074042, 38.52249222070792),
  (-121.48923220705949, 38.5226384001039),
  (-121.48887193496923, 38.52263970700418),
  (-121.48887157735834, 38.522492158296565),
  (-121.48923204074042, 38.52249222070792)),)

(提示: GeoJSON只应使用WGS84 )

这篇关于如何在Python中将UTM转换为纬度/经度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆