Closed wsf1990 closed 5 years ago
I use gdaltransform got the correct answer:
gdaltransform -s_srs EPSG:32650 -t_srs EPSG:4326
215018.25 4824066.75
which print:
113.474167779232 43.5151623354931 0
What version of pyproj are you using? I'm using pyproj 2.1.3, CRS is a new class in pyproj. If I need to change the code for a specific pyproj version I certainly can.
from pyproj import CRS, transform
wgs84 = CRS.from_epsg(4326)
utm50 = CRS.from_epsg(32650)
transform(utm50, wgs84, lon, lat)
Result:
(43.51516233549308, 113.47416777923233)
The current version of pyproj CRS takes a lot of CRS representation.
Pyproj version 2+ can do a lot of this kind of CRS handling because the underlying C library PROJ does a lot of this now, which makes PyCRS library less necessary.
My pyproj version is 1.9.6.Do your result correct? Should the lon lat reverse?
CRS won't work in pyproj version 1.9.6.
Here's code for 1.9.6.
from pyproj import transform, Proj
wgs84 = Proj(init="epsg:4326")
utm50 = Proj(init="epsg:32650")
lon, lat = 215018.25, 4824066.75
transform(utm50, wgs84, lon, lat)
Result:
(113.47416777923233, 43.51516233549308)
Should the lon lat reverse? I don't know what is going on there.
Thanks! I'll upgrade the pyproj version.But I think there is something wrong with the transform fn in pyproj 2.1.3.
I have test the two methods. And got the same answer as you.The result of two methods was reverse.
If this is happening on the latest release, 2.2.1, it would be well worth reporting it to pyproj's repo.
The only issue with upgrade pyproj is that you will have to upgrade PROJ, too.
I'll try. What's your meaning of upgrade PROJ
?
PROJ is the C library that is under the hood of pyproj. pyproj 1.9.6 has PROJ 4.9.3(I think). pyproj version 2+ required PROJ version 6+ . Unless you have PROJ 6+, you won't be able install pyproj 2+.
So was this a pyproj or pycrs issue?
Maybe it's caused by pyproj.
Sounds good, closing the issue then.
Hi, I found a new issue,I have a location which is
(lon, lat) (215018.25, 4824066.75)
, and the CRS isEPSG:32650
. When I transform this location toepsg:4326
use this code:I got this result:
-6.5258322207676605 43.51516233549309
.Which the lat is right, but the lon is wrong(the correct lon is about 113°),I think the question is located in the CRS’s center of Longitude.