I have a geojson that was added as a feature vector to openlayer. All the geojson in their properties section have some additional information that I want to display on clicking a feature (eg a popup) in 3d space. I used the ol-cesium overlay example to create a pop but there isn't a way to get the feature-geojson properties just with 3d(ol-cesium) enabled. Are there any approach to get the feature details on clicking a feature in 3d space?
ol-cesium: Is there a way to select a feature in ol-cesium and track it back to openlayers features?
Asked
Active
Viewed 532 times
1
-
found a solution and have posted in here [solution](https://github.com/openlayers/ol-cesium/issues/671) – Arvind Nov 08 '18 at 17:16
1 Answers
1
figured it out I think I had to do some think like this .
private getOlFeatureFromMouseLocationInOLCS(cesiumMouseEvent: any): OlFeature | undefined {
if (cesiumMouseEvent.position.x === 0 && cesiumMouseEvent.position.y === 0) {
return;
}
/**
//hoping the below two lines have bee defined early on .
this._ol3d = new OLCesium({ map: this._currentMap });
this.scene = this._ol3d.getCesiumScene();
**/
const pickedFeature = this.scene.pick(cesiumMouseEvent.position);
let olFeature: OlFeature;
if (pickedFeature.primitive) {
olFeature = (pickedFeature.primitive.olFeature)?pickedFeature.primitive.olFeature as OlFeature : undefined;
} else {
olFeature = undefined;
}
return olFeature;
}

Arvind
- 21
- 5