简体   繁体   English

如何在Python中将UTM转换为纬度/经度?

[英]How to convert the UTM to Lat/Long in Python?

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

these are my UTM coordinates for Sacramento city 这些是我对萨克拉曼多市的UTM坐标

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 但是我想在萨克拉曼多市找到这个纵向和横向的

Can anyone help me to convert the correct format to convert the UTM to LAN LONG coordinates. 谁能帮我转换正确的格式,以将UTM转换为LAN LONG坐标。

Your coordinates are using the "NAD83(NSRS2007) / California zone 2 (ftUS)" coordinate system: 您的坐标使用“ NAD83(NSRS2007)/加利福尼亚2区(ftUS)”坐标系:

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)

Result: 结果:

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

(Tip: GeoJSON should only use WGS84 ) (提示: GeoJSON应该仅使用WGS84

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM