Talk:Canada NTS Tile System

From OpenStreetMap Wiki
Jump to: navigation, search

Algorithm to determine NTS grid designator from latitude and longitude

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

If south of 80°N:

  1. Subtract 48 from the west longitude (positive number), divide the result by 8, take the integer part and multiply it by 10.
  2. Subtract 40 from the north latitude, divide the result by 4, take the integer part and add it to the result of step 1.

If between 80°N and 84°N, 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

Add one to the 1:1,000,000 sheet number if the latitude is between 84°N and 88°N.

To determine the 1:250,000 sheet letter

If south of 68°N:

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(4 × fPart((lat - 40) / 4)) × 10 + int(4 × fPart((lon - 48) / 8))

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

If between 68°N and 80°N:

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 Number Letter Number Letter
00 A 01 B 11 C 10 D
30 H 31 G 21 F 20 E

If north of 80°N:

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

If south of 68°N:

As an intermediate step, carry out the following calculation:

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

If between 68°N and 80°N, the calculation is as follows:

  • int(fPart(lat) × 4) × 10 + int(lon mod 4)

If north of 80°N, the calculation is this:

  • 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 13 5 20 9 33 13
01 2 12 6 21 10 32 14
02 3 11 7 22 11 31 15
03 4 10 8 23 12 30 16

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.

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.

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 the 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.

I hope you find this useful.

-- DENelson83 08:27, 7 March 2013 (UTC)