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

Support maxdecimaldigits option by geometry type #7166

Merged

Conversation

alexile
Copy link
Contributor

@alexile alexile commented Dec 7, 2020

Description of change

Adds support of PostGIS maxdecimaldigits option. The value comes from the existing precision option. Currently, it isn't possible, so the precision is always 9, therefore small, detailed elements either overlap or cannot be found using ST_Intersects, ST_Overlaps, etc. By default, PostGIS rounds all decimal places beyond maxdecimaldigits, which causes precision issues/ruins searching. This PR makes precision not only affect double but geometry types as well.

Fixes #7165

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@pleerock
Copy link
Member

pleerock commented Jan 4, 2021

Thank you for contribution!

Can you please add a test, so we can be sure added functionality won't break next time?

Where the number 9 comes from? Is it a postgres default? If yes, can it be added to the PostgresDriver.dataTypeDefaults property?

Or, since it's an optional argument, maybe for simplicity purpose we can simply append column.precision only if it was defined in there?

@alexile
Copy link
Contributor Author

alexile commented Jan 19, 2021

@pleerock correct, the number comes from ST_AsGeoJSON docs.

Or, since it's an optional argument, maybe for simplicity purpose we can simply append column.precision only if it was defined in there?

Makes sense, I will take a look

@pleerock
Copy link
Member

pleerock commented Feb 8, 2021

I added a simplification I was asking about. If you'll find time to write tests for this feature, it would be great to have them to avoid future breaking. Thank you!

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.

Support maxdecimaldigits option of geometry type
2 participants