I'm using pyProj to transform extents between two different geographical systems. In a case when both my systems are the same I expect to get back the same extents as inputted but this isn't happening for the below mentioned case:
import pyproj
inProj = pyproj.Proj("+init=EPSG:{0}".format(3857)) # Mercator
outProj = pyproj.Proj("+init=EPSG:{0}".format(3857))
x = (-20037507.0672, 20037509.6184)
y = (-1467048.29156, 8625918.8737)
print pyproj.transform(inProj,outProj,x,y)
The output comes out to be : ((-20037507.0672, -20037507.067178484), (-1467048.2915600014, 8625918.873699998))
Which is incorrect as my X-Coordinate extents are same for xMax and xMin.
If I change my co-ordinate systems
import pyproj
inProj = pyproj.Proj("+init=EPSG:{0}".format(3857)) # Mercator
outProj = pyproj.Proj("+init=EPSG:{0}".format(4326)) # WGS84
x = (-20037507.0672, 20037509.6184)
y = (-1467048.29156, 8625918.8737)
print pyproj.transform(inProj,outProj,x,y)
My X-coordinate output comes out to be : (-179.99998854118687, -179.99998854099357)
Which is again incorrect. Is this due to a domain issue in pyProj or is there any other reason ?
Best Answer
You make a mistake with the pyproj parameters
Control with GDAL (Python GDAL/OGR Cookbook: Projections)
If you want to use lists of coordinates: