CPSC 333: How Can You Determine a City's Location on a Map?

Location: [CPSC 333] [Assignments] [More about Problem to Model for Assignment #1] Determining a City's Location on a Map


Question:

How can you determine a city's location on a map?

Answer:

Each map will have its own coordinate system, like some city maps do. Vertical slices of a map will be labeled with letters of the alphabet (with the letters ``increasing'' as you move from left to right), or strings of letters of the alphabet, if there are more than 26 slices to label, while horizontal slices are labeled with numbers, with the numbers increasing as you move from the top of the map down toward the bottom.

The labels used for the vertical slices will be

A, B, C, ..., Z, AA, AB, AC, ..., AZ, BA, BB, ..., ZZ, AAA, AAB, AAC, ...

Each vertical slice of the map (that's labeled with a letter) will have the same width, and each horizontal slice will have the same height.

Thus, you should probably all keep track of the following information for each map.

Note that, if you know all this, as well as the latitudes and longitudes corresponding the map that were mentioned in the problem statement, then you can compute the letter of the vertical slice and number of the horizontal slice containing a given city (that is, its ``grid location'' on the map), from this city's latitude and longitude.


Department of Computer Science
University of Calgary

Office: (403) 220-5073
Fax: (403) 284-4707

eberly@cpsc.ucalgary.ca