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

Fix: Default SRID is bypassed when using floating point coordinates. #509

Merged
merged 5 commits into from
May 1, 2024

Conversation

aballet
Copy link
Contributor

@aballet aballet commented Apr 29, 2024

Description

This is a very simple one-character fix. Since v0.15.0, the new SPLIT_WKT_PATTERN regex did not account for floating point coordinates. The match() method returns None, and the default_srid is never applied in format_geom_type().

How do you suggest testing for this? Current functional tests do not have any floating point, so I could add one there? Or make them all floats instead of integers?

Checklist

This pull request is:

  • A documentation / typographical error fix
    • Good to go, no issue or tests are needed
  • A short code fix
    • Please include: Fixes: #<issue number> in the description if it solves an existing issue
      (which must include a complete example of the issue).
    • Please include tests that fail with the main branch and pass with the provided fix.
  • A new feature implementation or update an existing feature
    • Please include: Fixes: #<issue number> in the description if it solves an existing issue
      (which must include a complete example of the feature).
    • Please include tests that cover every lines of the new/updated feature.
    • Please update the documentation to describe the new/updated feature.

@adrien-berchet
Copy link
Member

Hi @aballet
You're absolutely right, thank you very much for spotting this issue and sorry about this stupid miss...
I think it makes sense to update the tests to include floating point numbers, especially in test_functional.py::TestInsertionCore::test_insert_all_geom_types. You can add a pytest.mark.parametrize to test with only integers or with floating points.

@adrien-berchet
Copy link
Member

I updated the test in aballet#1 so you can merge and then I'll merge this PR.

@aballet
Copy link
Contributor Author

aballet commented May 1, 2024

Ah, I see that I forgot to escape the dot myself, thank you!
I merged your code to include the tests.

@adrien-berchet adrien-berchet merged commit 344cb24 into geoalchemy:master May 1, 2024
10 checks passed
@adrien-berchet
Copy link
Member

Thanks for this work @aballet !
I'm going to push a new release.

@adrien-berchet
Copy link
Member

The new release is available: https://pypi.org/project/GeoAlchemy2/0.15.1/
I hope it will solve your issue @aballet
Anyway, thanks again for this PR @aballet !

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

Successfully merging this pull request may close these issues.

2 participants