I’m using cesium to add a wms layer to the globe and then extracting the lon, lat, and corresponding value for a pixel when clicked. So far this works fine using:
const handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(async (click) => {
const cartesian = viewer.camera.pickEllipsoid(click.position, scene.globe.ellipsoid);
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);`
Example code here
As far as I understand, viewer.camera.pickEllipsoid
returns the point on the surface of the ellipsoid or map in world coordinates, which returns the corresponding <FeatureInfoResponse>
from the WMS xml:
<?xml version="1.0" encoding="UTF-8"?><FeatureInfoResponse>
<longitude>-92.724609375</longitude>
<latitude>1.142578125</latitude>
<iIndex>1745</iIndex>
<jIndex>1777</jIndex>
<gridCentreLon>-92.72500314459501</gridCentreLon>
<gridCentreLat>1.124999980921217</gridCentreLat>
<FeatureInfo>
<time>2025-01-09T12:00:00.000Z</time>
<value>26.59</value>
</FeatureInfo>
</FeatureInfoResponse>
Question: how can I dynamically capture the <time>
and <value>
from the <FeatureInfo>
in the cesium-infoBox-description
as const time
and const value
? on click?