One thing is that you’re setting the arcType on one of the polygons but not the other. I’d make sure both have the same properties to make sure they align.
I actually wasn’t able to easily reproduce this, since the image’s corners contain transparency, so it’s hard to see where it actually ends. If you replace the image you have with just a solid white image it should be easier to see, like if you set img2Url to be:
We have georeferenced image that need to be placed of the correct polygon on map. We are trying to achieve it so image completelt covers footprint polygon and is not truncated - ie ideal match
From our observation it seems that Cesium applies image material to MBR of the polygon and mask it by the polygon so no image is displayed outside.
Do you have a georeferenced GeoTIFF version of your image? Usually the easiest way to get it in the correct location would be uploading it to Cesium ion (https://cesium.com/ion/) which will automatically reproject and place it in the correct location. Can you try that just for comparison and let me know if it produces the correct result?
Yes the image at https://public-test-bucket-123456.s3.amazonaws.com/grid-gcp-2.tif is georeferenced using GCP of all 4 corners. Unfortunately Cesium ION could not process it (Error:Missing or invalid spatial reference system File:grid-gcp-2.tif) - seems it does not support that type of referencing.
The uploaded TIFF does need to be a GeoTIFF with a defined CRS for ion to correctly reproject it and place it on the globe.
Would you be able to share a screenshot or ideally a Sandcastle of the WMTS that’s closer to correct? That’ll help provide a reference for us when debugging here. You can email support@cesium.com with a reference to this thread if you have data you can’t share publicly.
Thanks for putting together that code example. I can see the difference between the WMTS layer and the image. I can see that neither seem to be quite “correct” relative to the polygon. I do believe that the reason the image doesn’t fit the polygon in this case is likely in part due to the 1 pixel of transparency it has at one end that grows when stretched here.
For scaling, CesiumJS doesn’t have a way to scale the polygon directly, but you could use TurfJS to scale the polygon coordinates (see https://turfjs.org/docs/#transformScale) before creating the polygon. So you’d have the unscaled footprint, and when creating the polygon for the image, scale that up a little bit.