# Sandcastle Labels example, suggested update

**URL:** <https://community.cesium.com/t/sandcastle-labels-example-suggested-update/5012>\
**Category:** CesiumJS\
**Created:** [January 11, 2017, 7:39pm UTC](https://community.cesium.com/t/sandcastle-labels-example-suggested-update/5012 "2017-01-11T19:39:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Hall](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@Jonathan\_Hall](https://community.cesium.com/u/Jonathan_Hall)\
**Post date:** [January 11, 2017, 7:39pm UTC](https://community.cesium.com/t/sandcastle-labels-example-suggested-update/5012/1 "2017-01-11T19:39:56Z")

</div>

In the interest of improving documentation, while I experimented in the Labels example, I realized there’s an extra line of code in this function below.  
It’s redundantly setting a position for the billboard that’s identical to the position of it’s parent entity. If you don’t delete the unnecessary line of code, perhaps add a comment explaining that it’s only necessary if DIFFERENT than the parent entity, right?

Best regards-

-Jon

function offsetByDistance() {

Sandcastle.declare(offsetByDistance);

var image = new Image();

image.onload = function() {

viewer.entities.add({

position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),

billboard : {

//position : Cesium.Cartesian3.fromDegrees(-75.1641667, 39.9522222),

//position is inherited from parent entity,

//position is not necessary UNLESS specifying a DIFFERENT position than parent entity

//this could mislead someone getting started…

//scaleByDistance : new Cesium.NearFarScalar(1.5e2, 5.0, 1.5e7, 0.5),

image : image

},

label : {

text : ‘Label on top of scaling billboard’,

font : ‘20px sans-serif’,

showBackground : false,

horizontalOrigin : Cesium.HorizontalOrigin.CENTER,

pixelOffset : new Cesium.Cartesian2(0.0, -(image.height+(0.5\*20))),

eyeOffset: new Cesium.Cartesian3(0,0,-1),

//pixelOffsetScaleByDistance : new Cesium.NearFarScalar(1.5e2, 3.0, 1.5e7, 0.5)

}

});

};

image.src = ‘…/images/facility.gif’;

}

``

---

<div class="post-metadata">

**Author:** ![hannah](https://sea2.discourse-cdn.com/cesium/user_avatar/community.cesium.com/hannah/32/4509_2.png) [@hannah](https://community.cesium.com/u/hannah)\
**Post date:** [January 11, 2017, 8:30pm UTC](https://community.cesium.com/t/sandcastle-labels-example-suggested-update/5012/2 "2017-01-11T20:30:16Z")

</div>

Thanks for pointing that out, Jon! Deleting billboard.position seems like the right thing to do here.  
Would you be interested in opening a pull request with the fix? You can find instructions for doing this in our Contributing documentation here: [https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md#opening-a-pull-request](https://github.com/AnalyticalGraphicsInc/cesium/blob/master/CONTRIBUTING.md#opening-a-pull-request)

Best,

Hannah

---

<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:** [January 12, 2017, 3:32pm UTC](https://community.cesium.com/t/sandcastle-labels-example-suggested-update/5012/3 "2017-01-12T15:32:07Z")

</div>

You’re correct that the billboard position is unnecessary, likely a result of a copy/paste error in the example. To clarify your explanation, however: the billboard object literal here (which ends up being merged into a BillboardGraphics object, whose available properties are documented) simply does not have a position property at all. In the example, it is entirely ignored. There is no notion that a billboard’s position can be somehow different than the position of the containing entity.
