# I am getting the wrong result for north coordinate

``````from pyproj import Proj

#converting lat/long - UTM
lats = -22.818009494
longs = -47.059235202
alt = 644.2332

myProj = Proj("+proj=utm +zone=23K, +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
x, y = myProj(longs, lats)

print (x, y)
``````

I'm running this code and I'm getting this result below:

The E coordinate is right; however, the N coordinate is wrong

• Why do you think it is wrong? Because of the negative value? Commented Apr 14, 2021 at 0:06
• It is wrong because I know the correct answer LOL.... Commented Apr 14, 2021 at 0:14
• Could you add the correct one? Commented Apr 14, 2021 at 0:15
• 288652.545 7475152.818. which is interesting that it worked in my previous UBUNTU. I don't know after uploading it's not working. Commented Apr 14, 2021 at 0:18
• this is a duplicate of gis.stackexchange.com/questions/370838/… Commented Apr 15, 2021 at 21:31

It might be related to the proj string you specified. Use `CRS` instead of the proj string.

``````from pyproj import Proj, CRS

#converting lat/long - UTM
lat = -22.818009494
long = -47.059235202

crs = CRS.from_epsg(32723)  # 32723 -> UTM Zone 23S

myProj = Proj(crs)
x, y = myProj(long, lat)

print (x, y)

# OUT: 288652.54449622496 7475152.999493342
``````

What is the best format for describing coordinate reference systems?

The issue is the stray comma and unnecessary latitude band K. With the proj string, `+zone=` must be a value between 1-60, so just use 23 without a comma:

``````myProj = Proj("+proj=utm +zone=23 +south +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
x, y = myProj(longs, lats)
print(x, y)
# 288652.54449622496 7475152.999493342
``````

If you are able to use pyproj version 2 or later, take advantage of the CRS/Transformer classes, as detailed in the other answers.

• Interesting! Are commas ever used in valid proj strings? Commented Apr 14, 2021 at 10:35
• Commas are not expected for +zone (so this is partially a bug), but they are valid for multi-parameter terms e.g. +towgs84=-199.87,74.79,246.62 Commented Apr 14, 2021 at 21:41

You can also use the `transform` method in `Transformer` class.

``````from pyproj import Transformer

# 4326: WGS84 (source), 32723: UTM Zone23S (target)
transformer = Transformer.from_crs(4326, 32723)

lat = -22.818009494
long = -47.059235202

x, y = transformer.transform(lat, long)

print (x, y)

# 288652.54449622496 7475152.999493342
``````