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

[2.x] Refactor to remove GeometryType enum #120

Merged
merged 9 commits into from
Dec 31, 2024
Merged

Conversation

ahawlitschek
Copy link
Member

Being in cleanup mood and the open discussion in #118 about the geometry type cast append when building the raw sql, we wanted to remove GeometryType enum completly.

In order to control whether to use Geometry or Geography we added the AsGeometry and AsGeography Expressions, that adds the cast.
Moving the code into those 2 Expressions, we realized, that the Geometry and Box classes could directly implement the Expression interface.
This enabled even more code cleanup.

Before this PR, we casted to geometry all the time, because most of the ST_Functions from PostGIS are defined only on geometry. This PR removes this behavior. The user now needs to decide by himself, which type he wants to use using the cast expressions.
For a better readability we renamed to parameters of postgis functions that can handle geometry and geography to geometryOrGeography.

ahawlitschek and others added 4 commits December 31, 2024 13:47
In order to achieve this, we did the following:
1. Add AsGeometry.php & AsGeography.php Expressions, that adds the cast
2. Remove typeCastAppend when building SQL
3. Add Expression Contract to Box and Geometry
4. Remove Geometry as default type for magellan Expressions
5. Rename parameters of postgis functions from geometry to geometryOrGeography if geography is also accepted
6. Add & adjust tests

Co-authored-by: saibotk <[email protected]>
@studnitz studnitz changed the title Refactor to remove GeometryType enum [2.x] Refactor to remove GeometryType enum Dec 31, 2024
Base automatically changed from specific-casts to main December 31, 2024 13:32
@saibotk saibotk merged commit 6eb5a6a into main Dec 31, 2024
13 checks passed
@saibotk saibotk deleted the geometry-cast-expressions branch December 31, 2024 13:59
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