Skip to content

Feature: spatial attribute on all resources and collections#117

Merged
davemfish merged 8 commits intonatcap:mainfrom
davemfish:feature/93-more-spatial-attrs
Mar 9, 2026
Merged

Feature: spatial attribute on all resources and collections#117
davemfish merged 8 commits intonatcap:mainfrom
davemfish:feature/93-more-spatial-attrs

Conversation

@davemfish
Copy link
Collaborator

Fixes #93

  • Collections get a spatial attribute based on the spatial properties of items within.
  • non-spatial resources like tables, archives, get a spatial: null attribute by default, which can be set to an instance of models.SpatialSchema by the user if they wish.

Copy link
Contributor

@claire-simpson claire-simpson left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks!

@empavia
Copy link

empavia commented Mar 4, 2026

This looks great to me! To confirm, this allows for manual entry of a spatial field for tables and archives, correct?

@davemfish
Copy link
Collaborator Author

This looks great to me! To confirm, this allows for manual entry of a spatial field for tables and archives, correct?

Yes, there is a set_spatial() method on tables and archive resources, so you can set it that way. Or of course editing the text file is always possible. I imagine a typical case would be setting the spatial fields to be the same as another spatial dataset, so there will be an example in the readme of that:

table_resource = geometamaker.describe('foo.csv')
raster_resource = geometamaker.describe('foo.tif')
table_resource.set_spatial(raster_resource.spatial)
# or
table_resource.spatial = raster_resource.spatial

The individual attributes of spatial are immutable, so this will not work:
table_resource.spatial.bbox = [1, 2, 3, 4]

@empavia
Copy link

empavia commented Mar 5, 2026

This looks great to me! To confirm, this allows for manual entry of a spatial field for tables and archives, correct?

Yes, there is a set_spatial() method on tables and archive resources, so you can set it that way. Or of course editing the text file is always possible. I imagine a typical case would be setting the spatial fields to be the same as another spatial dataset, so there will be an example in the readme of that:

table_resource = geometamaker.describe('foo.csv')
raster_resource = geometamaker.describe('foo.tif')
table_resource.set_spatial(raster_resource.spatial)
# or
table_resource.spatial = raster_resource.spatial

The individual attributes of spatial are immutable, so this will not work: table_resource.spatial.bbox = [1, 2, 3, 4]

This is great! Thank you.

@davemfish davemfish merged commit cbc5502 into natcap:main Mar 9, 2026
16 checks passed
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.

Provide spatial extent field for non-spatial files

3 participants