如何在Python中将UTM转换为Lat / Long?

时间:2021-09-05 21:20:08
{
  "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坐标。

1 个解决方案

#1


0  

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)

#1


0  

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)