Selecting an image layer

A concise explanation of the problem you’re experiencing.

I’m trying to add some functionality where users can click on an image layer to do various things. Currently, viewer.scene.drillPick() (for example) does not return anything like that as it focuses on tilesets and entities. Is there a way to click on a image layer and find out which one it was? My Google-foo seems to come up empty-handed.

The Cesium version you’re using, your operating system and browser.

Chrome, Windows, Cesium: all latest

Cheers,

Alex

Hey Alexander,

Some imagery providers do support that, like the ArcGISMapServiceImageryProvider: https://cesium.com/docs/cesiumjs-ref-doc/ArcGisMapServerImageryProvider.html#pickFeatures

What kind of imagery do you have? If you know the extents of your imagery perhaps you could compute which one was hit based on the position that was clicked?

Hi Omar,

Thanks for your reply. We use a number of different ones, and I guess I was hoping for a simpler solution since Cesium knows where it puts everything. :slight_smile: But now that you mention it, I could write my own picker against the objects in the current view, and then find the right one by looking at the stack in the layers. Hmm. We didn’t use to have bounding boxes of images apart from the rectangle, but I think now we do trace a bounding area. Hmm. Yes, I think I’ll give that a try.

Still, I wish Cesium could also put other interesting things in their picker. And thanks for jolting my brain into action.

Cheers,

Alex

Glad I could help Alexander!

I think most uses of imagery layers I’ve seen have been global layers so a pick would just give you the topmost layer. Is your use case that you have a lot of different local imagery layers? What kind of information would you ideally get when picking them? Just to know which one was clicked?

If it’s a common enough use case it’d help us motivate a feature request on GitHub.

Hi there,

Yeah, most of our use cases are about picking local imagery and doing things with them. They often overlap, but can also stand on their own, and there’s functionality associated with each, even a multitude (like a spreadsheet associated with several orthos spread out across a local area).

Cheers,

Alex

Thanks for the explanation Alex. I think it might be nice to have this as a built-in feature. I opened this GitHub issue to consider adding and see what others think:

https://github.com/CesiumGS/cesium/issues/8692

Feel free to weigh in there too if I missed anything.

Thanks Omar, I added a few additional thoughts.

Cheers,

Alex