flyTo polygon created by GeometryInstance


First of all, is there a different method for PolygonOutline?
if not how can i do flyTo polygon created by GeometryInstance?

I am using the following codes for PolygonOutline. But I can not use the flyTo function for this polygon I created.

var positions = Cesium.Cartesian3.fromDegreesArray(coords);
        var polygonOutlineInstance = new Cesium.GeometryInstance({
            geometry: Cesium.PolygonOutlineGeometry.fromPositions({
                positions: positions
            attributes: {
                color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.RED)
        var primite = new Cesium.Primitive({
            geometryInstances: [polygonOutlineInstance],
            appearance: new Cesium.PerInstanceColorAppearance({
                flat: true,
                renderState: {
                    lineWidth: Math.min(2.0, viewer.scene.maximumAliasedLineWidth)

Hi there,

See the example in the reference documentation for PolygonOutlineGeometry. You’ll need to specify polygonHierarchy instead of positions.

You can’t use Viewer.flyTo by directly passing the geometryInstance (only entities), but you can use Camera.flyTo and pass the position for the destination.