Talk:Canada NTS Tile System

From OpenStreetMap Wiki
Jump to: navigation, search

Algorithm to determine NTS grid designator from latitude and longitude

The NTS is divided into three zones, each zone covering a different range of latitudes. Your first step is to determine which of these three zones contains the latitude of your given point, and to do that, use this table:

Table 0
Latitude interval Zone
[40, 68) Southern zone
[68, 80) Arctic zone
[80, 88) High Arctic zone

If you are unfamiliar with interval notation, "[" means 'greater than or equal to the first number', and ")" means 'less than the second number'.

Whichever zone you come up with, keep it in mind as you work through this algorithm.

To determine the 1:1,000,000 sheet number

Southern or Arctic zone

  • Tens: Subtract 48 from the west longitude (positive number), divide the result by 8, and take the integer part.
  • Ones: Subtract 40 from the north latitude, divide the result by 4, and take the integer part.
  • Multiply the Tens value by 10 and add the Ones value to get a single integer value.

High Arctic zone

If your latitude is in the interval [80, 84), use this simple look-up table:

Table 1
Longitude interval 1:1,000,000 sheet number (*)
[56, 72) 120
[72, 88) 340
[88, 104) 560
[104, 120) 780
[120, 136) 910

(*) If your latitude is in the interval [84, 88), use Table 1, but add one to the 1:1,000,000 sheet number.

To determine the 1:250,000 sheet letter

Southern zone

As an intermediate step, carry out the following calculation, where int(x) is the integer portion of x and fPart(x) is the decimal portion of x:

  • int(fPart((lat - 40) / 4) × 4) × 10 + int(fPart((lon - 48) / 8) × 4)

You should end up with a base-4 number. To determine the 1:250,000 sheet letter, use this look-up table:

Table 2
Number Letter Number Letter Number Letter Number Letter
00 A 01 B 02 C 03 D
10 H 11 G 12 F 13 E
20 I 21 J 22 K 23 L
30 P 31 O 32 N 33 M

Arctic zone

Carry out the following calculation:

  • (int(lat mod 4) × 10) + int((lon / 4) mod 2)

Then use this look-up table to determine the 1:250,000 sheet letter:

Table 3
Number Letter Number Letter
00 A 01 B
10 D 11 C
20 E 21 F
30 H 31 G

High Arctic zone

Carry out the following calculation:

  • int(lat mod 4) × 10 + (int(lon / 8) + 1) mod 2

Then use Table 3 to determine the 1:250,000 sheet letter.

To determine the 1:50,000 sheet number

As an intermediate step, carry out one of the following calculations.

Southern zone int(fPart(lat) × 4) × 10 + int(fPart(fPart((lon - 48) / 8) × 4) × 4)
Arctic zone int(fPart(lat) × 4) × 10 + int(lon mod 4)
High Arctic zone int(fPart(lat) × 4) × 10 + int((lon mod 8) / 2)

Whichever calculation is required, plug its result into the look-up table below:

Table 4
Input Output Input Output Input Output Input Output
00 1 10 8 20 9 30 16
01 2 11 7 21 10 31 15
02 3 12 6 22 11 32 14
03 4 13 5 23 12 33 13

Example 1: Southern zone

Let's determine the map sheet that the CN Tower in Toronto is found on. According to Wikipedia, it is located at 43.6426°N 79.3871°W, which is between 40°N and 68°N.

The first step is determining the 1:1,000,000 sheet number. Following the calculation given above:

  • int((79.3871 - 48) / 8) × 10 + int((43.6426 - 40) / 4)
  • = int(31.3871 / 8) × 10 + int(3.6426 / 4)
  • = int(3.9233875) × 10 + int(0.91065)
  • = 30

The next step is determining the 1:250,000 sheet letter. Following the calculation given above:

  • int(4 × fPart((43.6426 - 40) / 4)) × 10 + int(4 × fPart((79.3871 - 48) / 8))
  • = int(4 × fPart(3.6426 / 4)) × 10 + int(4 × fPart(31.3871 / 8))
  • = int(4 × fPart(0.91065)) × 10 + int(4 × fPart(3.9233875)
  • = int(4 × 0.91065) × 10 + int(4 × 0.9233875)
  • = int(3.6426) × 10 + int(3.69355)
  • = 33

Now, using Table 2 above, the value 33 corresponds to the sheet letter M.

Finally, we determine the 1:50,000 sheet number. Following the calculation given above:

  • int(4 × fPart(4 × fPart((79.3871 - 48) / 8))) + int(4 × fPart(43.6426)) × 10
  • = int(4 × fPart(4 × fPart(31.3871 / 8))) + int(4 × 0.6426) × 10
  • = int(4 × fPart(4 × fPart(3.9233875))) + int(2.5704) × 10
  • = int(4 × fPart(4 × 0.9233875)) + 2 × 10
  • = int(4 × fPart(3.69355)) + 20
  • = int(4 × 0.69355) + 20
  • = int(2.7742) + 20
  • = 22

Using Table 4 above, the value 22 corresponds to the sheet number 11.

Putting it all together gives a full NTS sheet designator of 30M11.

Example 2: Arctic zone

Let's determine which map sheet contains Inuvik in the Northwest Territories. According to Wikipedia, it is at 68.361667°N, 133.730556°W. Since we're between 68°N and 80°N, we calculate it as follows:

The calculation for the 1:1,000,000 sheet number is the same as in the Southern zone:

  • int((133.730556 - 48) / 8) × 10 + int((68.361667 - 40) / 4)
  • = int(85.730556 / 8) × 10 + int(28.361667 / 4)
  • = int(10.7163195) × 10 + int(7.09041675)
  • = 107

Next, we determine the 1:250,000 sheet number. That calculation goes like this:

  • int(68.361667 mod 4) × 10 + int((133.730556 / 4) mod 2)
  • = int(0.361667) × 10 + int(33.432639 mod 2)
  • = 0 + int(1.432639)
  • = 01

Table 3 converts that number to B.

Now for the 1:50,000 sheet number. The calculation is as follows:

  • int(fPart(68.361667) × 4) × 10 + int(133.730556 mod 4)
  • int(0.361667 × 4) × 10 + int(1.730556)
  • int(1.446668) × 10 + 1
  • = 11

Plugging that value into Table 4, we get 7.

Putting it all together, that plots Inuvik on map sheet 107B7.

Example 3: High Arctic zone

Let's determine the map sheet that Alert in Nunavut is found on. Wikipedia gives its location as 82.501389°N, 62.338889°W. Since we're north of 80°N, the calculation is this:

We use Table 1 to determine our 1:1,000,000 sheet number. Since the longitude is between 56°W and 72°W, the number is 120.

Next, we determine the 1:250,000 sheet number:

  • int(82.501389 mod 4) × 10 + (int(62.338889 / 8) + 1) mod 2
  • = int(2.501389) × 10 + (int(7.792361125) + 1) mod 2
  • = 2 × 10 + (7 + 1) mod 2
  • = 20 + 8 mod 2
  • = 20 + 0 = 20

Plugging 20 into Table 3, we get the letter E.

Now for the 1:50,000 sheet number:

  • int(4 × fPart(82.501389)) × 10 + int((62.338889 mod 8) / 2)
  • = int(4 × 0.501389) × 10 + int(6.338889 / 2)
  • = int(2.005556) × 10 + int(3.1694445)
  • = 23

Using Table 4 above, the value 23 corresponds to the sheet number 12.

Putting it all together gives a full NTS sheet designator of 120E12.

Additional precision of westing and northing values

You'll notice that I've highlighted some numbers in blue and red. These numbers represent decimal fractions across and up the map sheet, and can optionally be put after the map sheet ID string to produce so-called "NTS coordinates". The blue number is the "westing" value, while the red number is the "northing" value. You can specify these values using as many digits as you wish, but make sure you leave any leading zeroes intact. For the sake of consistency, it is recommended that the northing be written after the westing. So for example, the NTS coordinates of the CN Tower would be 30M11 77420 57040.

If you wish to calculate these westing and northing values directly, here's how to do it to obtain five-digit values:

Westing Northing
Southern zone int(fPart(lon × 2) × 100 000) int(fPart(lat × 4) × 100 000)
Arctic zone int(fPart(lon) × 100 000) int((lat mod 0.25) × 400 000)
High Arctic zone int((lon mod 2) × 50 000) int((lat mod 0.25) × 400 000)

-- DENelson83 02:39, 7 July 2018 (UTC)