What kind of Coordinate system is Cesium using?

1,230 views
Skip to first unread message

wilso...@gmail.com

unread,
Sep 16, 2015, 5:44:40 PM9/16/15
to cesium-dev
I am loading a KML file into Cesium and trying to load the KML point position by clicking on it. I am using the code below to get the coordinate:

var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas); handler.setInputAction(function(click) {

var pickedObject = viewer.scene.pick(click.position);
var positionUnformat = pickedObject.id.position.getValue(viewer.clock.currentTime);

}, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);

However, the coordinate i got from this code seems like to be different from what is actually written in the KML file. It is not the true position and altitude of the real world. How can I get the position coordinate correct? Or I have to transform the value to get the right answer?

falc...@gmail.com

unread,
Sep 16, 2015, 9:14:32 PM9/16/15
to cesium-dev, wilso...@gmail.com
Cesium uses radians by default for angular measurements. You'll need to convert the coordinates you see using Cesium.Math.toDegrees(yourRad)

Matthew Amato

unread,
Sep 16, 2015, 9:24:41 PM9/16/15
to cesiu...@googlegroups.com
The position you are getting is in Earth-fixed Cartesian coordinates, so those numbers are in meters.  You can easily convert this to longitude/latitude/height.  See the "Show Cartographic Position on Mouse Over" example for the details: http://cesiumjs.org/Cesium/Apps/Sandcastle/index.html?src=Picking.html&label=Showcases


--
You received this message because you are subscribed to the Google Groups "cesium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cesium-dev+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

wilso...@gmail.com

unread,
Sep 18, 2015, 11:24:44 AM9/18/15
to cesium-dev
Hi Matthew,
Thanks for your answer. I can get the proper longitude and latitude right now, however I still can not get the correct altitude. The value of the altitude is always zero. Do I have to load the height map by setting something before I can get the value of KML file altitude?

Matthew Amato

unread,
Sep 21, 2015, 8:26:56 PM9/21/15
to cesiu...@googlegroups.com
Is the data being clamped to the ground?  Otherwise the height should be correct.  If it's being clamped, then the value is expected to be 0.  Can you post the Placemark snippet and style from the KML file?

wilso...@gmail.com

unread,
Sep 22, 2015, 11:40:25 AM9/22/15
to cesium-dev
Yes, here is the whole part of the KML file omitted the description part:

<kml xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns="http://www.opengis.net/kml/2.2">
<Document>
<Folder>
<name>BusinessRule1</name>
<Style id="BR1Stl">
<IconStyle>
<Icon>
<href>blackcircle.png</href>
</Icon>
<scale>0.7</scale>
</IconStyle>
<LabelStyle>
<scale>0.8</scale>
</LabelStyle>
</Style>
<Placemark id="103215">
<name>51-AIRPORTSGIS-103215</name>
<styleUrl>#BR1Stl</styleUrl>
<description>....</description>
<Point>
<altitudeMode>absolute</altitudeMode>
<coordinates>-76.43594397,36.77823129,33.3030576</coordinates>
<extrude>1</extrude>
</Point>
</Placemark>
</Folder>
</Document>
</kml>

Is the data clamped to the ground? How can I know that?

Scott Reynolds

unread,
Sep 23, 2015, 11:13:26 AM9/23/15
to cesium-dev, wilso...@gmail.com
<altitudeMode>absolute</altitudeMode> indicates that the data is not to be clamped to the ground.  See this for more information.

Scott
Reply all
Reply to author
Forward
0 new messages