Open emackey opened 9 years ago
possibly related to #3247?
Also reported here: https://groups.google.com/forum/?hl=en#!topic/cesium-dev/pp-vskchuVY
Did anyone fixed this?
Related bug found here - https://github.com/CesiumGS/cesium/issues/9916.
hello, I am still seeing this using the following code:
viewer.scene.canvas.addEventListener('mousemove', function (e) { var ellipsoid = viewer.scene.globe.ellipsoid; // Mouse over to get lat/lng var cartesian = viewer.camera.pickEllipsoid(new Cesium.Cartesian3(e.clientX, e.clientY), ellipsoid); if (cartesian) { var cartographic = ellipsoid.cartesianToCartographic(cartesian); var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(6); var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(6); document.getElementById("latLngDisplay").innerHTML = 'Lat,Lng: ' + longitudeString + ', ' + latitudeString; } });
is there a workaround?
the values I am getting seem to be from (0.0, 0.0) when an entity is tracked.
looking at function Qat in Cesium.js (bp @ line 12407, column 219352) In the debugger, when I do not have an entity tracked, I get e: en:: _position { "x": -17809439.158786256, "y": 2529375.7111355397, "z": 12756274 } e: en:: _positionWC { "x": 12756274, "y": -17809402.829757854, "z": 2529595.748431439 } -=-=-=- when I have an entity tracked, I get e: en:: _position { "x": 0, "y": 0, "z": 12756365.13519999 } e: en:: _positionWC { "x": 12756274, "y": -17809402.829757854, "z": 2529595.748431439 }
looks like viewer.camera.positionCartographic is correct when an entity is tracked, but the viewer.camera.position is at 0,0.
Hi @timeichfeld-msa, there hasn't been any activity on this item recently.
If you'd like to add more information about your use case, that may help us prioritize. If you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR. Thanks!
here is the javascript code: /* Test Process:
1.) move the mouse around the blue square.
READOUT Expected result: the readout in the upper left corner should read the lat,lng of the mouse position.
READOUT Actual Result: the readout in the upper left corner shows a relative location from 0,0
MOUSE READOUT Expected Result: the mouse readout should show the label above the mouse position with the lat,lng
MOUSE POSITION Actual Result: the mouse readout is displayed at the (0,0) position (Zoom out to view off the coast of Africa.)
*/
const viewer = new Cesium.Viewer("cesiumContainer",{ sceneMode: Cesium.SceneMode.SCENE2D, });
//readout viewer.entities.add({ id: 'mouseReadout', label: { show: false, eyeOffset: new Cesium.Cartesian3(0, 500, -1000) } });
var entity = viewer.entities.add({ position : Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883), box : { dimensions : new Cesium.Cartesian3(1000.0, 1000.0, 100.0), material : Cesium.Color.CORNFLOWERBLUE }, name: "blue square" });
viewer.camera.flyTo( { destination: Cesium.Cartesian3.fromDegrees(-75.59777, 40.03883, 10000.0) } );
viewer.scene.canvas.addEventListener('mousemove', function (e) {
//TODO: Picking when an entity is tracked in the camera yields incorrect results
var entity = viewer.entities.getById('mouseReadout');
var ellipsoid = viewer.scene.globe.ellipsoid;
// Mouse over the globe to see the cartographic position
var cartesian = viewer.camera.pickEllipsoid(new Cesium.Cartesian3(e.clientX, e.clientY), ellipsoid);
if (cartesian) {
var cartographic = ellipsoid.cartesianToCartographic(cartesian);
var longitudeString = Cesium.Math.toDegrees(cartographic.longitude).toFixed(6);
var latitudeString = Cesium.Math.toDegrees(cartographic.latitude).toFixed(6);
//NOTE: For label at mouse position
entity.position = cartesian;
entity.label.show = true;
entity.label.font_style = 12;
entity.label.text = 'Lat,Lng: ' + latitudeString + ', ' + longitudeString;
var result = entity.label.text;
document.getElementById("readout").innerHTML = entity.label.text;
}
});
Here is the css/html:
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar">
<div id="readout"></div>
</div>
Thanks much :)
@ggetz
Hello, I have not seen any additional activity since I posted the code. Was the Cesium Team able to have a look? Should I file a new bug to be prioritized?
Thanks much, -Timothy
Thanks for the test case @timeichfeld-msa!
There hasn't been any activity on this item recently. We'd ask that you keep conversation for a single issue in one place.
If you are interesting in contributing, please let us know and we'd be happy to discuss implementation or review a PR. Thanks!
@ggetz Hi Gabby, what kind of contribution is needed, do you mean financial or code development? Please let me know how to proceed.
Thanks much, -Timothy
@timeichfeld-msa I was referring to code contributions. But we do consider service work for roadmap-aligned services. For that, email sales@cesium.com.
@ggetz
Hi Gabby, Understood :) Thank you for the clarification.
We are just beginning to explore the CesiumJS API to satisfy our use-cases and requirements. As we are still in learning mode, I think it would be premature for us to contribute good workable code that would help make Cesium better. We are just not up to speed with Cesium internal design, dependencies and requirements to be efficient with both our development investigation and in helping make Cesium better.
What I am able to do now is investigate our use-cases and look to the Cesium Team for API guidance and advice on resolving issues that we may encounter. Please let me know how to proceed.
Thanks much, -Timothy
Here's a combination of our Sandcastle Picking + CZML demos:
The picking appears to work fine in 3D and Columbus View, and works in 2D as long as you're not tracking a CZML Entity. If you're tracking in 2D however, picking has an unexplained offset, large enough that you have to zoom out to most of the map to see the spot picked.
via StackOverflow.