CesiumGS / CesiumGS/cesium

Drill picking support for clicking to select entities

Open
#4,373 2 comments 0 reactions 0 assignees View on GitHub
category - entity category - picking type - enhancement
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Problem: When multiple data sources or layers are added to a map, clicking on the map will only display information about the topmost entity.

From this example:

``` js
var viewer = new Cesium.Viewer('cesiumContainer');

viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson'));
viewer.dataSources.add(Cesium.GeoJsonDataSource.load('../../SampleData/ne_10m_us_states.topojson', {
fill: Cesium.Color.PINK
}));
```

Clicking on a U.S. state will display the InfoBox only for the second data source. In general, there's no way to select multiple entities that might be overlapping.

For example, when multiple features are selected from imageryLayers:

``` js
if (!defined(features) || features.length === 0) {
viewer.selectedEntity = createNoFeaturesEntity();
return;
}

// Select the first feature.
var feature = features[0];

var entity = new Entity({
id : feature.name,
description : feature.description
});
```

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Widgets/Viewer/Viewer.js#L156

Only the first feature is selected.

I was wondering if there could be a case for creating a "Feature Selection" widget that would allow people to select multiple features, or if this is beyond the scope of the core framework functionality should be added as a plugin / 3rd party modification. I'd be happy to contribute, if there's interest in adding such functionality.

Contributor guide

Open the contributing guide

Research direction

Start with Source/Widgets/Viewer/Viewer.js around the referenced selection logic and review how imagery-layer features are reduced to the first feature. Define the intended multi-feature selection behavior and whether it belongs in the core Viewer or a separate widget or plugin before identifying implementation and test entry points.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.