ThinkGeo.com    |     Documentation    |     Premium Support

Rotating tifs on map

I’m currently adding tifs to the map using a filepath to the tif and a bounding box like so:

NativeImageRasterLayer n = new NativeImageRasterLayer(tifPath, boundingBox);

This shows up fine, but I also need to be able to rotate this bounding box. I’ve tried applying a RotationProjection, changing the boundingbox, etc., but I’m unable to rotate it properly. How can this be done?

Thanks.

Hi Dan,

It looks the tiff file should be rendered by GeoTiffRasterLayer now, NativeImageRasterLayer is no longer to be used for tiff file. So I think your version should not be the latest version.

Change the boudingbox only modify the image location but cannot rotate it. And RotationProjection don’t works well with tiff file now, I will let our developer know it and maybe we will enhancement support this type data in future.

If you have the custom logic for rotate image you can modify it like this:

public class rotateGeoTiffRasterLayer : GeoTiffRasterLayer
{
    public rotateGeoTiffRasterLayer(string imagePathFilename) : base(imagePathFilename)
    {
        ImageSource = new rotateGeoTiffRasterSource(imagePathFilename);
    }
}

public class rotateGeoTiffRasterSource : GeoTiffRasterSource
{
    public rotateGeoTiffRasterSource(string imagePathFilename) : base(imagePathFilename)
    {
    }

    protected override GeoImage GetImageCore(RectangleShape worldExtent, int canvasWidth, int canvasHeight)
    {
        GeoImage image = base.GetImageCore(worldExtent, canvasWidth, canvasHeight);            
        // Rotate the image here
        return image;
    }
}

Wish that’s helpful.

Regards,

Ethan