how to select items from the Viewer?

Hi, I’m Álex

In first place, thanks for your time.
I have a different questions about how to select items from the Viewer:

My first questions:
How can i select from a polygon elements in the visor?

My second question:
How can i select all elements from the viewer?

And finally
Exists any method in cesium for make this?

Thanks a million
Álex

Alex,

When you add an entity to the viewer, you can specify an id like this:
viewer.entities.add({
   id: 'some unique id',
   name: 'My Entity',
   ...
});

Then you can find that entity by looking it up using the id:
var entity = viewer.getById('some unique id');

Read about this function here:
https://cesiumjs.org/Cesium/Build/Documentation/EntityCollection.html#getById

You can access all entities by:
var entities = viewer.entities.values;

Hope that help.
-Steven

Hi Steven,

In first place thanks for your time.

That isn't exactly what we need.
Actually we need.
From a polygon drawn manually i want to pick all items inside it.

Thanks a million.
Álex.

Hi Alex,

I’m not sure exactly what you mean here by elements. Do you mean entities? If so, picking might be the way to do so.

Thanks,

Gabby

Thanks a million.
Álex.