fromDegrees not mapping the same as my KML

I am trying to get an entity (or a SingleTileImageryProvider anyone i can get to work) to map my image to a globe. I have a kml file that maps/looks right (no imagery stuff just a box).

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
  <Placemark>
          <name>Maui</name>
          <visibility>1</visibility>
          <styleUrl>#transBluePoly</styleUrl>
          <Polygon>
            <tessellate>1</tessellate>
            <altitudeMode>absolute</altitudeMode>
            <outerBoundaryIs>
              <LinearRing>
                <coordinates>
                    -156.6225,20.5594444444444,1000
                    -156.676388888889,20.8205555555556,1000
                    -156.205833333333,20.9055555555556,1000
                    -156.1525,20.6447222222222,1000
                  </coordinates>
              </LinearRing>
            </outerBoundaryIs>
          </Polygon>
        </Placemark>
</kml>

So I have tried this code in the entities to map a rectangle:

              var redRectangle = viewer.entities.add({
                    name : 'Red translucent rectangle with outline',
                    rectangle : {
                        coordinates : Cesium.Rectangle.fromDegrees(-156.6225,20.5594444444444,-156.1525,20.6447222222222),
                        material : Cesium.Color.RED.withAlpha(0.5),
                        outline : true,
                        outlineColor : Cesium.Color.RED

                    }

I am not sure where my disconnect is but this is not even coming close to the foot print in the KML file. Not sure what I am doing wrong but getting these to match up would be awesome. Then I could ignore the fact that cesium doesn't handle tiled imagery in my kmz and just map the one image 1:1 onto the globe as a stop gap measure until further support for regions exists in Cesium.

Just a graphic to show what I am seeing:

Hello,

Instead of using a rectangle, try using a polygon with those four coordinates:

viewer.entities.add({
polygon : {
hierarchy : Cesium.Cartesian3.fromDegreesArray([-156.6225,20.5594444444444,
-156.676388888889,20.8205555555556,
-156.205833333333,20.9055555555556,
-156.1525,20.6447222222222]),
material : Cesium.Color.RED
}
});

``

The rectangle is meant to follow the longitude and latitude lines, which is why it doesn’t line up.

Best,

Hannah

indeed that worked! Though using my image as a material still doesn't line up (I am guessing it is a scaling/zoom level issue). I might have to throw in the towel on hacking a work around to get images tiled onto the virtual globe for now . I just cannot seem to find a way that makes this work. On a whim I tried this even:

            layers.addImageryProvider(new Cesium.SingleTileImageryProvider({
                url : 'Sandcastle/images/test.png',
                polygon : Cesium.Cartesian3.fromDegreesArray([-156.6225,20.5594444444444,
                         -156.676388888889,20.8205555555556,
                         -156.205833333333,20.9055555555556,
                         -156.1525,20.6447222222222])
                }));
             });

Maps the test.png to the entire globe, I am guessing SingleTileImageryProvider does not like a rectangle property.

Oh okay, I understand what you’re trying to do now. We don’t currently have support for KML lat lon quads and projecting the image to rectangles like this.
It’s part of our KML roadmap: https://github.com/AnalyticalGraphicsInc/cesium/issues/2179

I’m not sure how long it will be before we have a chance to address this though.

You can take a look at this issue to see how they worked around adding an image: https://groups.google.com/d/msg/cesium-dev/x3sYLgIr8Mc/t4tSUBh3CQAJ

-Hannah