简体   繁体   中英

pyproj returning inf for UTM

I am gettin x = [inf inf inf.....] and y = [inf inf inf...]. Has anyone encountered this error before? I am attempting to convert lon and lat into xy values. I have the following code but I cannot figure out what is incorrect. This is San Diego data set.

import scipy.io;
from pyproj import Proj;

canyon = scipy.io.loadmat('INIT.MAT');
topo = canyon.get('siocanyon');

lat = tuple(topo[:, 0])
lon = tuple(topo[:, 1])
z = topo[:, 2]

myProj = Proj(proj='utm', zone=11, ellps='WGS84', preserve_units=False)
y, x = myProj(lon, lat)

I just tested the code with a sample position from San Diego:

from pyproj import Proj

lat = 32.715687
lon = -117.161380
#z = 100

myProj = Proj(proj='utm', zone=11, ellps='WGS84', preserve_units=False)
x, y = myProj(lon, lat)
print(x, y)

gives

484876.3791751535 3619780.206742558

You can test your results using an online converter .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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