# Landscape Rotation

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

When you make a landscape, you may want to orient some part of the image towards North or some other bearing.

For spherical type landscapes (the formal name for this sort of panorama is a equirectangular panorama), you can use the following procedure for calculating the rotation needed. The rotation can be specified using the angle_rotatez setting in the landscape.ini file.

In this image, there is a tree. Let's say you want this tree to appear at bearing 0 degrees in Stellarium (due North).

First, you need to calculate the distance from the left side of the landscape image to the tree as a fraction of the total image width, and then use these numbers in the following formula:

```270 + b - ( 360 * x / X )
```

where:

• b is the bearing you want to have the chosen object, in degrees. Use 0 for North, 90 for East etc.
• x is the distance in pixels from the left side of the image to the object you want to align.
• X is the horizontal image size.

For example, here's the landscape image again, with some measurements:

Putting the figures in the equation:

```  270 + b - ( 360 * x / X )
= 270 + 0 - ( 360 * 364 / 512 )
= 14.06
```

If the result is outside the range 0 ... 360, you should add or subtract 360 to bring it into this range.

The figure of 14.06 should be put into the landscape.ini file like this:

```[landscape]
name = Test
author = Matthew
description = Test landscape to demonstrate alignment
type = spherical
maptex = image.png
angle_rotatez = 14.06
```

Note that the landscape image I am using in the example will work, but it's not a very good landscape image, so you might want to try this with a better panorama. The moon landscape which comes with Stellarium is a good one to practice on. As an exercise to check you know how to do it, consider applying a rotation to the moon landscape, having the astronaut due South. Check your answer here.