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

BUG: allow appending df with no CRS to postgis with no CRS #3328

Merged
merged 4 commits into from
Jun 7, 2024

Conversation

nicholas-ys-tan
Copy link
Contributor

@nicholas-ys-tan nicholas-ys-tan commented Jun 6, 2024

small one to close out #2158, #2763, and stale MR #2159

Changing the default no CRS value to 0 to be consistent with postgis. There are a few different proposed approaches to this floating about the above issues/PRs, but this one is based on the comments in #2159 . It is not clear to me why -1 was selected as the no CRS value in the first place, so I may be missing some important context.

EDIT

Looking at shapely.get_srid(), it returns a -1 if it is run on None, but 0 when on a geometry with no CRS. The docstring does only specify -1 for 'not-a-geometry value' but does not specify 0 is the no CRS value. Perhaps this misinterpretation was the origin of using -1 as the no CRS value here?

Closes #2158, closes #2763, closes #2159

Copy link
Member

@martinfleis martinfleis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea where the -1 came from but 0 is the correct value for undefined CRS. One minor note in tests, otherwise it looks good. Thanks!

geopandas/io/tests/test_sql.py Outdated Show resolved Hide resolved
@martinfleis martinfleis added this to the 1.0 milestone Jun 6, 2024
Co-authored-by: Martin Fleischmann <martin@martinfleischmann.net>
Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

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