Skip to content

Comments

Add support for affine 3.0 Affine class serialization#3299

Merged
sgillies merged 5 commits intomaint-1.4from
issue3298
Jan 27, 2025
Merged

Add support for affine 3.0 Affine class serialization#3299
sgillies merged 5 commits intomaint-1.4from
issue3298

Conversation

@sgillies
Copy link
Member

@sgillies sgillies commented Jan 25, 2025

Rasterio now defines a to_json() function to use with json.dumps(). By default it returns its argument. To turn objects like Affine instances into JSON serializable tuples, we register functions with the to_json() dispatcher in rio/info.py, rio/sample.py, and rio/warp.py.

I've tested this locally with the main branch of the affine project.

Resolves #3298.

@sgillies sgillies added this to the 1.4.4 milestone Jan 25, 2025
@sgillies sgillies self-assigned this Jan 25, 2025
0.0, -300.041782729805, 2826915.0,
0, 0, 1.0))
self.assertEqual(s.meta['crs'], s.crs)
Affine(
Copy link
Member Author

Choose a reason for hiding this comment

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

This assertion works for affine versions 2 and 3.

@sgillies sgillies merged commit cb12c6c into maint-1.4 Jan 27, 2025
22 checks passed
@sgillies sgillies deleted the issue3298 branch January 27, 2025 15:05
@sgillies sgillies mentioned this pull request Feb 8, 2026
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