i have shapefile of san francisco loaded need convert coordinates longitude/latitude form. variables have follows:
w1 = x coordinates w2 = y coordinates
currently coordinates this:
print(w1[0], w2[0]) 6017864.66784 2104744.54451
i've tried convert points such:
from pyproj import proj, transform inproj = proj(init='epsg2227') outproj = proj(init='epsg4326') x1, y1 = w1[0], w2[0] x2, y2 = transform(inproj, outproj, x1, y1) print(x2, y2) -70.44154167927961 41.036642156063856
san francisco's coordinates approximately -122 degrees west , 37.7 degrees north. believe problem inproj , outproj commands have wrong epsg can't figure out should be. appreciated.
i learned more pyproj had intended:
all need add preserve_units = true
projection aliases:
w1=[1] w2=[1] w1[0]=6010936.158609 w2[0]=2090667.302531 pyproj import proj, transform inproj = proj(init='epsg:2227', preserve_units=true) outproj = proj(init='epsg:4326', preserve_units=true) x1, y1 = w1[0], w2[0] x2, y2 = transform(inproj, outproj, x1, y1) print(x2, y2) [out]: -122.4, 37.8
basically preserve_units
use local units instead of standard meters.
basically 2227 in survey foot units , 4326 in degrees , treating both meters