Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

To_srid fails, proj can't be created #1

Open
ion-elgreco opened this issue Oct 29, 2024 · 8 comments
Open

To_srid fails, proj can't be created #1

ion-elgreco opened this issue Oct 29, 2024 · 8 comments

Comments

@ion-elgreco
Copy link

ion-elgreco commented Oct 29, 2024

I was trying to convert some values to a different crs since I need to add a buffer, but I noticed that it fails because a proj can't be created. I guess the coordinates data is missing, any idea on how to pre fetch this?

Haven't gotten the ability to dive into proj crate to much

(Cool project btw, it's a great alternative considering the state of GeoPolars atm)

@Oreilles
Copy link
Owner

Would you mind giving a minimal reproducible example ?

@Oreilles
Copy link
Owner

You might have faced the following error:

ComputeError: the plugin failed with message: generic error: Couldn't create transformation from EPSG:0 to [...]

This error message might be improved, but EPSG:0 is not a valid CRS, it means that your data don't have a SRID assigned and therefore cannot be projected. If that is the case, you would need to assign an SRID to your geometries first:

df = df.with_columns(st.geom().st.set_srid(4326))

@Oreilles Oreilles changed the title To_crid fails, proj can't be created To_srid fails, proj can't be created Oct 30, 2024
@ion-elgreco
Copy link
Author

You might have faced the following error:

ComputeError: the plugin failed with message: generic error: Couldn't create transformation from EPSG:0 to [...]

This error message might be improved, but EPSG:0 is not a valid CRS, it means that your data don't have a SRID assigned and therefore cannot be projected. If that is the case, you would need to assign an SRID to your geometries first:

df = df.with_columns(st.geom().st.set_srid(4326))

Currently don't have access to a system to create a reproducible example. Was working in an air gapped environment.

Regarding the set_srid, I did set everything to 4326.

I saw some prints in stdout when trying to convert the srid about a "proj db missing"

@Oreilles
Copy link
Owner

I managed to reproduce the issue. It is strange that it happens considering Proj and Sqlite are statically linked...

@ion-elgreco
Copy link
Author

Hmm, do you think it's solvable? Or maybe you can give some pointers then I can take a look next weekend

Currently it's a key thing we need to continue otherwise we have to still do manual projections :p which would defeat the purpose of staying in polars

@Oreilles
Copy link
Owner

Oreilles commented Nov 7, 2024

It should be solvable yeah, but that would require diving a bit into how maturin does the packaging.

In the meantime, I'm working on a more general solution allowing yourself to apply any python transform function to the coordinates, so you may be able to use pyproj for that soon.

@ion-elgreco
Copy link
Author

It should be solvable yeah, but that would require diving a bit into how maturin does the packaging.

In the meantime, I'm working on a more general solution allowing yourself to apply any python transform function to the coordinates, so you may be able to use pyproj for that soon.

A native expression would be preferred though for perf

@kgoodrick-uu
Copy link

I got this error in macOS 15.1.1 and was able to resolve it by setting the PROJ_LIB environment variable.

os.environ["PROJ_LIB"] = pyproj.datadir.get_data_dir()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants