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

Feature request: spatial cropping from select table rows #284

Open
LucaMarconato opened this issue Jun 5, 2023 · 2 comments · May be fixed by #626
Open

Feature request: spatial cropping from select table rows #284

LucaMarconato opened this issue Jun 5, 2023 · 2 comments · May be fixed by #626
Labels
API About the API/ UX

Comments

@LucaMarconato
Copy link
Member

From @EliHei2:

do we have reverse spatial queries? i.e., can one select some rows from the table and get the cropped image? easier case rectangular crops and more advanced exact curvatures?

I am currently working on similar things, so I adding this to my todo list.

@sinanugur
Copy link

Hi,

Is this feature available?

I want to visualize the whole image where the spots are available but I am getting the visualization of the entire image. I have to create a boundind_box manually. Is there a way to only show where the spots are?

Cheers,
Sinan

@LucaMarconato
Copy link
Member Author

Hi, for shapes and points you could use the new API (not available last year) join_spatialelement_table() with how='right' to return a SpatialElement that contains only the geometries corresponding to the table.

If you are using labels, how='right' is not available, but with the new to_polygons() API you can easily convert the labels to polygons/multipolygons.

Finally, after you have the polygons that match the rows in one of the two ways described above, you can use get_extent() (also new) to compute the bounding box of the geometries matching to the rows. You can use this to crop eventual images or even the whole SpatialData object.

Please let me know if it fits your use cases and if you have further questions.

@aeisenbarth aeisenbarth linked a pull request Jul 8, 2024 that will close this issue
@giovp giovp added the API About the API/ UX label Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API About the API/ UX
Projects
None yet
3 participants