Reputation: 21
I am trying to use pyproj to transform the Calfornia State Plane Zone 5 X-Y coordinates to Latitude, Longitude.
For validation, I kniow that CA Zone 5 X-Y coordinates (6559361.78613, 1834842.95456) is the address 13422 Ankerton St, Bassett, CA. The Latitude, Longitude should be (34.0342403°, -118.0076074°).
inProj = Proj(init='epsg:2229')
outProj = Proj(init='epsg:4326')
x1,y1 = x1,y1=6559361.78613, 1834842.95456
LONGITUDE,LATITUDE = transform(inProj,outProj,x1,y1)
print(LATITUDE,LONGITUDE)
However, the output is (34.65142393815357°, -65.96879755500356°)
, which is somewhere in the Atlantic, far from California Zone 5.
Upvotes: 1
Views: 1197
Reputation: 21
inProj = Proj(init='epsg:2229', preserve_units=True)
outProj = Proj(init='epsg:4326')
x1,y1 = x1,y1=la_df['X_COORDINATE'][0], la_df['Y_COORDINATE'][0]
LONGITUDE,LATITUDE = transform(inProj,outProj,x1,y1)
print(LATITUDE,LONGITUDE)
Turns out that pyproj assumes that you are working in meters. To keep using the Imperial system, you must include the option preserve_units=True
.
Upvotes: 1