0

I am trying to convert latitude and longitude(EPSG:4326) to projected coordinate systems(NAD83(NSRS2007) / Minnesota South). I followed this tutorial.

My code:

TRAN_4326_TO_3596 = Transformer.from_crs("EPSG:4326", "EPSG:3596", always_xy=True)

def mytransform(lon, lat):
  return TRAN_4326_TO_3596.transform(lon, lat)
geo_df[['xproj', 'yproj']] = pd.DataFrame(geo_df.apply(lambda x: mytransform(x['longitude'], x['latitude']), axis=1).tolist(), columns=['foo', 'bar'])
geo_df_sb_cari = geo_df[geo_df["location_name"].isin(["Caribou Coffee", "Starbucks"])]

enter image description here

As you can see in the pic attached I am getting a ton of NaN values for my x and y projections.

What might I be doing wrong?

1 Answer 1

1

I recommend enabling errcheck=True as that can provide insight. However, I didn't see an issue when I ran it for one of your points:

>>> tr = Transformer.from_crs("EPSG:4326", "EPSG:3596", always_xy=True)
>>> tr.transform(-93.328812, 44.913376, errcheck=True)
(852997.3704333376, 312818.1964341999)

I would recommend enabling internal PROJ debugging: https://pyproj4.github.io/pyproj/stable/advanced_examples.html#debugging-internal-proj

import logging
import os

os.environ["PROJ_DEBUG"] = "2"
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)

Though, I suspect it has to do with PROJ network issues related to errors downloading transform grids:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.