Skip to content

Conversation

@jesspav
Copy link
Collaborator

@jesspav jesspav commented Sep 13, 2025

Currently, invalid inputs to proj via ST_Transform are resulting in large log dumps to std out.

For example, for a single row:

> SELECT ST_Transform(ST_GeomFromText('POINT (1000 1000)'), 'EPSG:4326', 'EPSG:3857') as geom;
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
webmerc: Invalid latitude
Execution error: Transform error: PROJ coordinate transformation failed with error: Invalid coordinate

Since we are already capturing and sharing the error message, this change lowers the log level to none/0, but allows users to override it.

After this change, the excess error messages no longer appear and the user can jump straight to the useful error message. For example:

> SELECT ST_Transform(ST_GeomFromText('POINT (1000 1000)'), 'EPSG:4326', 'EPSG:3857') as geom;
Execution error: Transform error: PROJ coordinate transformation failed with error: Invalid coordinate

Tracking issue: #30

@jesspav jesspav marked this pull request as ready for review September 13, 2025 00:40
@jesspav jesspav requested a review from paleolimbot September 13, 2025 00:40
Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

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

Thank you!

(proj_sys is an optional dependency that isn't built in the Python bindings...instead we use the runtime linking feature...I think the suggestions will fix the build)

@jesspav
Copy link
Collaborator Author

jesspav commented Sep 13, 2025

Yeah, you are right, I was not thinking about whether the constant I referenced would be available without proj being installed. Good thing the build here caught that.

Copy link
Member

@paleolimbot paleolimbot left a comment

Choose a reason for hiding this comment

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

Thank you!

@jiayuasu jiayuasu merged commit 0d9a7c8 into apache:main Sep 14, 2025
12 checks passed
@jesspav jesspav deleted the log branch November 14, 2025 22:21
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.

3 participants