spatialdata-plot icon indicating copy to clipboard operation
spatialdata-plot copied to clipboard

(Optional) fast extent computation for large vector data

Open LucaMarconato opened this issue 2 years ago • 3 comments

As long as plotting is concerned, the extent of the data doesn't need to be super precise. The get_extent() function has a parameter exact=True, which could speed up the computation of extents for vector data when set to False.

Specifically, if exact=False, the extent is computed as the transformed extent of the raw data. This is guaranteed to contain all the data points, and usually is not too large of the real extent.

Therefore, for large collections of points (one can set a threshold empirically after some real tests), I would consider to consider setting exact=False to speed up things.

Note: maybe the speed up is negligible compared to the time require to render the data, so I would benchmark before making a decision.

LucaMarconato avatar Oct 09 '23 20:10 LucaMarconato

Is this still relevant @LucaMarconato ?

timtreis avatar Nov 06 '24 17:11 timtreis

yes

melonora avatar Nov 08 '24 12:11 melonora

Yes; it would be fast to address this issue.

get_extent(..., exact=False) has an effect only for points and shapes that have a transformation.

  1. I would first check if setting it to False leads to a performance improvement when plotting many points and when plotting many shapes. The points and shapes should have a transformation that does something, for instance a rotation by 45 degrees.

If there is no performance improvement (because for instance the rendering time is much larger), we can stop here. Otherwise I would switch to exact=False. 2. Note that the artifacts will have to be regenerated as when there is a rotation, exact=False will introduce some padding.

LucaMarconato avatar Jan 05 '25 15:01 LucaMarconato