How to loading objects that are outside the current viewer context using a room object, scope box, point

Please excuse any awkward or unclear phrasing, as I’m using a translation tool…

Objective

We are planning to implement a feature that allows loading objects outside the current Speckle Viewer context by using spatial inputs such as room objects, bounding boxes, or point-based extents.

More specifically, we want to retrieve objects based on:

coordinate ranges (e.g. XYZ extents),

or spatial relationships (e.g. intersection / containment with a given object or volume).

Question / Issue

Does the Speckle Viewer or Speckle Server API provide any built-in functionality to:

query or retrieve objects by coordinate range,

perform spatial joins between objects (e.g. get all elements intersecting a room or bounding box),

or load only objects that intersect a given spatial volume?

At the moment, it seems that object retrieval is primarily ID-based or hierarchy-based, rather than spatially queryable.

Proposed Approach

One possible approach we are considering is:

computing and storing AABB (axis-aligned bounding box) metadata for each object at import time,

persisting those AABB values in the database,

and using them for spatial filtering during query requests before loading data into the viewer.

Before going down this path, we would like to understand:

whether similar functionality already exists in Speckle,

or whether this approach aligns with Speckle’s intended architecture.

Context / Use Case

Our use case involves large models where loading all objects into the viewer upfront is not desirable.
We want to dynamically load only spatially relevant subsets of data based on user-selected spatial inputs.

Speckle Link

(Not yet available — this is currently a design / architecture question.)

Environment

  • Speckle Viewer (Web)
  • Custom backend / database integration

Thanks for your help.

Hi @BIN628

The speckle viewer library builds an acceleration structure which you can use for all your spatial/intersection needs. However, this gets built only after data is loaded in.

There currently no built in way to selectively load objects based on spatial criteria. However because you are building you own application there are some things you could do but it does require handling extra information.

This could work. Not sure how efficient it would be and how feasible for massive datasets, but if you could manage to compute the AABBs in a hierarchical fashion I think it might be realistic.

There is currently no builtin way for filtering objects at query time based on spatial criteria

I might not be the person to respond to this, but seeing as you are building your own app using our libraries I think sky’s the limit…

Let us know if you have other questions. We will do our best to assist

Cheers

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.