Skip to content

Conversation

@chikle9090
Copy link
Contributor

This PR addresses issue #3902 by expanding the documentation for +proj=affine.

Summary of changes

  • Clarifies that affine input angular values are interpreted in radians.
  • Clarifies that affine output angular values are expressed in degrees.
  • Notes that proj +proj=affine cannot be used directly and will raise an error.
  • Explains that affine must be used as a step inside a PROJ pipeline.
  • Adds examples demonstrating actual behavior (including the cs2cs example from the issue).
  • Adds recommendations for correct usage with geographic vs projected coordinates.

Checklist

  • Closes Mention affine units #3902
  • Tests added (N/A – documentation-only change)
  • Added a clear title suitable for release notes
  • Fully documented (updated affine.rst accordingly)

Copy link
Member

@rouault rouault left a comment

Choose a reason for hiding this comment

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

I strongly suspect you have used some LLM/AI tool to generate that. There's a lot of uselessly verbose and inaccurate statements.

Comment on lines 61 to 65
When :code:`+proj=affine` is used on angular coordinates (longitude/latitude):

* **Input angular values are interpreted in radians**
* **Output angular values are expressed in degrees**

Copy link
Member

@rouault rouault Dec 3, 2025

Choose a reason for hiding this comment

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

This is not true. affine is not unit aware at all.

The unit conversion is done here by cs2cs and we could argue this is a bug of cs2cs to accept +proj=affine. Normal manual usage of +proj=affine should be done with the cct utility

Comment on lines 89 to 92
Example of valid usage inside a pipeline:

proj pipeline +step +proj=affine +xoff=1

Copy link
Member

Choose a reason for hiding this comment

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

the proj utility isn't appropriate to execute pipelines. That should be done with cct

Comment on lines 93 to 103
**3. Recommended usage**

The affine transformation is generally intended for:

* Modifying projected coordinates
* Applying small adjustments inside pipelines
* Implementing EPSG parametric and similarity transforms

When applied to geographic coordinates, users must explicitly handle/unit-convert
angles as needed.

Copy link
Member

Choose a reason for hiding this comment

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

Not useful

@chikle9090
Copy link
Contributor Author

Thank you for the clarification, and apologies for the inaccuracies.
I misunderstood how units were being handled in the example, and I now see that the radians/degrees behavior comes from cs2cs rather than the affine operation itself. I will revise the documentation to remove this incorrect explanation.
I will also update the examples to use cct instead of proj, and remove the unnecessary recommended usage section.
Thank you again for the guidance — I will push corrected changes shortly.

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.

Mention affine units

2 participants