# Offset a position reference?

**URL:** https://community.cesium.com/t/offset-a-position-reference/5272
**Category:** CesiumJS
**Created:** [March 10, 2017, 10:58pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272 "2017-03-10T22:58:43Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Kit\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@Kit\_Kennedy](https://community.cesium.com/u/Kit_Kennedy)
#### Post date: [March 10, 2017, 10:58pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272/1 "2017-03-10T22:58:43Z")

</div>

Hi all,  
I’m trying to figure out the best way to add a simple, conic shape that follows a satellite and serves as a “sensor”. I’ve gotten very close to getting what I need, but it’s not quite there, and now I’m stymied. I’m no Cesium or javascript expert by any means.

Using Cesium 1.27, I created an object (an entity?) as part of a larger CZML file in which I’ve already defined the position of CubeSat1:

{  
“id” : “obs1”,  
“name” : “obs1cone\_sat15”,  
“cylinder” : {  
“length” : 530000.0,  
“topRadius” : 0.0,  
“bottomRadius” : 400000.0,  
“material” : {  
“solidColor” : {  
“color” : {  
“rgba” : [255, 0, 0, 150]  
}  
}  
},  
“verticalorigin”: “TOP”,  
“fill” : true,  
“show”: [  
{  
“interval”: “2017-03-15T10:00:00Z/2017-03-15T11:00:00Z”,  
“boolean”: false  
},  
{  
“interval”: “2017-03-15T11:00:00Z/2017-03-16T09:00:00Z”,  
“boolean”: true  
},  
{  
“interval”: “2017-03-16T09:00:00Z/2017-03-16T10:00:00Z”,  
“boolean”: false  
}  
]  
},  
“position”:{  
“reference”:“Satellite/CubeSat1#position”  
}

``

The cone shows up as in the attached pic. The problem is that it’s centered on the satellite, when I actually want it below that sat. Of course I could directly specify the position coordinates of the cone separately from the satellite, but I’d really like to be able to just reference its position.

Is there any way to specify a fixed offset from a position reference? Like, 10 km along the CubeSat1 -\> Earth Center line?

Also, is there an easier way to do this? I see tantalizing hints of a easier world with the “ConicSensor”, but I have no idea how to use this in a CZML file. ([https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/ConicSensor](https://github.com/AnalyticalGraphicsInc/czml-writer/wiki/ConicSensor))

Another side question - when I specify a cone that follows CubeSat1 position, as above, it actually rotates with the sat’s orbit and manages to always face towards the center of the earth. Why is this? Is the sat’s orientation rotating constantly wrt to the earth center line?

Any help would be much appreciated! Thanks in advance!

-Kit Kennedy

![Screen Shot 2017-03-10 at 5.52.08 PM.png](https://global.discourse-cdn.com/cesium/original/1X/55406692a91792ad992dad6d600bbff275a247d0.png)

---

<div class="post-metadata">

### Author: ![Harry\_Nicholls](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@Harry\_Nicholls](https://community.cesium.com/u/Harry_Nicholls)
#### Post date: [March 11, 2017, 3:49pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272/2 "2017-03-11T15:49:02Z")

</div>

Hi Kit,

Are you able to share your source code?

I may be able to help on the Javascript side of things.

- Harry

---

<div class="post-metadata">

### Author: ![Kit\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@Kit\_Kennedy](https://community.cesium.com/u/Kit_Kennedy)
#### Post date: [March 11, 2017, 4:40pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272/3 "2017-03-11T16:40:51Z")

</div>

Hi Harry,  
Sure thing, attaching what I think is all the relevant code

runner\_lite.html is in a folder in the apps directory, sats\_file\_lite.czml is in the subdir app\_data\_files. Also, I removed my bing maps key from runner\_lite

-Kit

[runner\_lite.html](https://community.cesium.com/uploads/short-url/xsvvnE1khddT0lukm0lRIVpaqRT.html) (1.04 KB)

[sats\_file\_lite.czml](https://community.cesium.com/uploads/short-url/nuQgxZWCsyvBGYMFACoEDPl6LdO.czml) (151 KB)

---

<div class="post-metadata">

### Author: ![Scott\_Hunter](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/scott_hunter/32/2006_2.png) [@Scott\_Hunter](https://community.cesium.com/u/Scott_Hunter)
#### Post date: [March 11, 2017, 8:49pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272/4 "2017-03-11T20:49:30Z")

</div>

Offset positions in CZML are not currently supported. However, this has come up before, and would be a useful addition, if you are interested in pursuing it. Basically, this would entail defining a new way to define “position” properties in CZML, using a reference and a time-varying cartesian offset. Cesium would also need a new type of PositionProperty that calculates the resulting position value.

---

<div class="post-metadata">

### Author: ![Kit\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@Kit\_Kennedy](https://community.cesium.com/u/Kit_Kennedy)
#### Post date: [March 11, 2017, 9:14pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272/5 "2017-03-11T21:14:27Z")

</div>

Thanks Scott, that’s helpful - I very well may end up going down that route in the future. For the time being, would “ConicSensor” be a solution for my problem? As I mentioned, it looks what I need, but I just don’t know how to use it in CZML…

thanks,

Kit

---

<div class="post-metadata">

### Author: ![Harry\_Nicholls](https://avatars.discourse-cdn.com/v4/letter/h/51bf81/32.png) [@Harry\_Nicholls](https://community.cesium.com/u/Harry_Nicholls)
#### Post date: [March 14, 2017, 2:28pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272/6 "2017-03-14T14:28:06Z")

</div>

I suggest using a [callback property](http://cesiumjs.org/Cesium/Build/Documentation/CallbackProperty.html?classFilter=callba) for the position of the cone. That way you can reference the position of the cube sat, but offset the height by x metres. Tweaking the offset should allow you to position the cone as you wish.

To use a callback property you’ll need to create the cone in JS, not CZML, create a function that gets the position of the cube sat, and set the cones position as the callback property. I haven’t had time to make an example, will do if I find some time!

---

<div class="post-metadata">

### Author: ![Kit\_Kennedy](https://avatars.discourse-cdn.com/v4/letter/k/e480ec/32.png) [@Kit\_Kennedy](https://community.cesium.com/u/Kit_Kennedy)
#### Post date: [March 19, 2017, 6:54pm UTC](https://community.cesium.com/t/offset-a-position-reference/5272/7 "2017-03-19T18:54:00Z")

</div>

Great, thanks Harry! I’ll probably punt on this for now, but that’s a good suggestion.

-Kit
