I am using GDAL to generate TIFFs from an int array that my code generates. These arrays come with a rotation value to rotate the generated image. These are very low resolution (10x30 as an example), so if I rotate the actual image data, then I end up with 'sawtooth' edges. I could upscale the image, but there would always be some level of jagged edges in the image.
I'm wondering if it is possible to rotate the raster within the Maps SDK, similar to graphics/feature rotation.
I tried using PictureMarkerSymbols on graphics for my images and then just rotated each graphic individually, but my graphics were auto scaling with the map so I could not zoom in. I also could not get the IdentifyGraphicsOverlayAsync() call to get the moused over image pixel value, so this option does not seem viable.
The ideal scenario is I generate rectangular raster images (to maintain smooth edges), apply the rotation to the layer within my map so that the edges are still smooth, then use the IdentifyLayersAsync() method to get cell values on mouse over.
Rasters will rotate based on their world file or georeference coordinates. If you rotated the image, it wouldn't align with the underlying map any longer.
If you generate these images, can't you generate them in an un-rotated fashion? (as in north up).
Thanks for the quick reply!
I tried generating a world file (*.tfw) alongside my TIFF, but the maps SDK doesn't seem to recognize the file. Am I using the correct extension for my world file? Or are they not supported for TIFFs? I have only ever gotten world files to work on PNG or JPEG images, but those won't work for my case due to the multi-band 8bit nature of those formats.
It's also very possible I am just building my world file wrong. My setup looks like this:
longitude // upper-left X
resolution * cosA // X resolution
resolution * sinA // rotation term
latitude // upper-left Y
-resolution * sinA // rotation term
resolution * cosA // Y resolution
I originally was using GDAL to set the geotransform on my tiff. This correctly rotates my TIFF within my map, but it produces those sawtooth edges I mentioned. I think this is due to fitting the pixels to the maps grid, rather than just rotating the image in the display?
To further explain my situation, I have a collection of points on my map. Each point has an associated image (in the form of a 2D int array), a bearing, and a resolution value. I am using the resolution and int array to generate the image. I then wanted to place the image centered at the point using the point's bearing to rotate the image to the correct orientation. The user also needs a mouse readout for cell value.
We currently have some custom controls for displaying this data which essentially just uses WPF Image and Canvas controls with some rotation transforms to rotate the images and some math to calculate relative positions between images. We also calculate the mouse-over position on the image and then use that to query to cell value from the original array. This setup is very clunky and there is a lot of benefit in including these images directly in our map alongside our other data, other than just the inherent benefits of the map such as zooming & callouts.
I did some additional testing:
I took one of the TIFFs that I georeferenced and rotated using GDAL and imported that image into ArcGIS Pro. The edges are perfectly smooth here and I can seemingly zoom into infinitely without compromising quality. If I load the same image into my map as a RasterLayer I get heavily blurred and jagged edges. Is there possibly a setting that is configured wrong on my map or is this anti-aliasing(?) not available in the Maps SDK?