CesiumGS / CesiumGS/cesium

geojson pick confusion when set perPositionHeight

Open
#10,091 8 comments 0 reactions 0 assignees View on GitHub
category - picking type - bug type - regression
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

hello

I use GeoJsonDataSource to load geojson data, when i set the perPositionHeight=false,single click on the map to pickup a geojson feathure, it may return a wrong result.

![image](https://user-images.githubusercontent.com/42760174/153555299-d4687bd4-8146-42a3-9ce4-9d980daac967.png)

when i set entity.polygon.perPositionHeight = false, it will happen,but if set entity.polygon.perPositionHeight = true, it works fine. this happens with cesium version 1.88, when change cesium version to 1.74,it works fine as well.

following is the code:
```js
var promise = Cesium.GeoJsonDataSource.load('data/wenmiao.json', { clampToGround: true });
promise.then(function (dataSource) {
// viewer.dataSources.add(dataSource);
var entities = dataSource.entities.values;
for (var i = 0; i < entities.length; i++) {
var entity = entities[i];
entity.polygon.perPositionHeight = false;
entity.polygon.classificationType = Cesium.ClassificationType.BOTH;
entity.heightReference = Cesium.HeightReference.CLAMP_TO_GROUND
entity.polygon.material= Cesium.Color.BLUE;
viewer.entities.add(entity)
}
});
viewer.flyTo(promise);
var scene = viewer.scene;

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function (movement) {
var pick = viewer.scene.pick(movement.position);
if(pick){
selectedEntity = pick.id;
pick.id.polygon.material = new Cesium.Color(255, 0, 0, 1)
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
```

Contributor guide

Open the contributing guide

Research direction

The report names no repository files or tests; start by running the supplied GeoJsonDataSource and scene.pick reproduction with Cesium 1.88 and perPositionHeight=false. Done means a single click consistently identifies the intended GeoJSON entity, while the reported true and Cesium 1.74 comparisons remain understandable.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.