More

Performing transformation with pyproj?


This seems like it should be straight forward, but I'm struggling to get the correct transformation from my state plane to lat long.

My code is as follows

# projection from spatialreference.org/ref/epsg/2992/ # oregon is espg ref 2992 projection = r'+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=399999.9999984 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048 +no_defs' osp2992 = Proj(projection)

Now when I try and check against the input/output they show in the upper right corner

# Input Coordinates: -119.88481361812, 43.453242550659 # Output Coordinates: 1475673.108308, 621492.180223 >>>osp2992(-119.88481361812, 43.453242550659) (449785.16341222316, 189430.81653184193)

It's way off.

I'm not sure where I went wrong.

Edit: removed the to_meter conversion and still getting wrong output

projection = r'+proj=lcc +lat_1=43 +lat_2=45.5 +lat_0=41.75 +lon_0=-120.5 +x_0=399999.9999984 +y_0=0 +ellps=GRS80 +datum=NAD83 +no_defs' >>>osp2992(-119.88481361812, 43.453242550659) (550261.2548834425, 157725.95224630416)

Your test output coordinates are in feet, while pyproj is giving you the answer in meters, which is what it does by default

Define your projection this way instead :

osp2992 = Proj(projection, preserve_units=True) osp2992(-119.88481361812, 43.453242550659) (1475673.1083078186, 621492.18022257846)


Watch the video: The Fast Fourier Transform FFT: Most Ingenious Algorithm Ever? (October 2021).