d4b

Translation of latitude/longitude to ADC map coordinates

Oct 30, 2008 19:10

Overview:

ADC map books are (physical) street atlases which use a proprietary coordinate system, expressing locations as a map page number and a grid location within each map page. This post shows how to translate the coordinates of a given location from a standard latitude/longitude pair (geographic coordinates) to the corresponding ADC map grid location.

Justification:

Each SEPTA (CCT Connect) paratransit driver's tour has (very roughly) 50 locations which must be found, and then a route must be determined to reach each of these, (usually) in order. Drivers are often given about ten minutes to perform this task (manually) at the start of each day's tour, i.e., about 12 seconds per location, on average. As I just started, it's currently taking me about 2½ hours to do this, i.e., about three minutes each, on average. Seeing as these addresses must be in a computer file at some point, it may be possible to use a service like the Google Maps API (either in PHP or in JavaScript) to translate a street address to a latitude/longitude pair, and then perform the ADC map grid location determination programmatically (as shown below). Anything I can do to reduce this lookup time is a Good Thing. :-)

Method:

Convert all degrees/minutes/seconds triplets to decimal degrees, (60 seconds per minute, 60 minutes per degree), i.e., degrees + (minutes + seconds/60) / 60. Latitude (the first number of the pair) goes north from the equator; longitude goes east from Greenwich, and thus is a negative number in Philadelphia. Each grid rectangle is 22½ by 22½ seconds, i.e., three-eighths of a minute, squared*. Convert the given latitude/longitude pair (Wlat, Wlong) to a linear grid pair of integers (Lx, Ly), as follows.

Note that both the order of the pair changes, as well as both axes "flip" in direction, i.e., The (Wlat, Wlong) pair is (in this area) (North, West), and the (Lx, Ly) pair starts in the northwest (upper left) corner, and goes west to east (left to right), then north to south (top to bottom).

For ease, all ranges include the northwest corner and exclude the southeast corner.

I'm using "int()" for the integer function, and "%" to indicate the modulo function.Lx = int( (Wlong - Olong) * 60 / (3/8) )
Ly = int( (Olat - Wlat) * 60 / (3/8) )
Determine the map page number:P = B + int( Ly / 10 ) * R + int( Lx / 10 )
Determine the grid location within that map page:Gx = Lx % 10, expressed as a letter starting with A for 0, and skipping the letter "I", i.e., 8 and 9 are J and K, respectively.
Gy = Ly % 10 + 1
The standard notation shows the map page number P, followed by a hyphen, then Gx, then Gy, with no spaces, i.e., "P-GxGy". Yes, ten is expressed with two digits.

Local Values:

The ADC map book for Metro Philadelphia has sixty pages, as shown below. Note that other map books may have more or less than two bounded regions.For the area between:and:Base
page:Row
size:OlatOlong(southeast corner, exclusive)BR40° 11' 15" N75° 33' 45" W40° 07' 30" N74° 56' 15" W325211240° 07' 30" N75° 33' 45" W39° 48' 45" N74° 56' 15" W3364110

Example:

Philadelphia City Hall is located at 39° 57' 10" N, 75° 09' 49" W. That's in the region between 40° 07' 30" N, 75° 33' 45" W and 39° 48' 45" N, 74° 56' 15" W, or, converting everything to decimal degrees:40.1250 ≥ 39.9528 > 39.8125
-75.5625 ≤ -75.1636 < -74.9375
So thus, we will use the second bounded region from the table above. Convert to a linear grid pair:Lx = int( (-75.1636 - -75.5625) * 60 / (3/8) ) = 63
Ly = int( (40.1250 - 39.9528) * 60 / (3/8) ) = 27
(Notice the order reversal and the flipped axes: the first coordinate is now horizontal distance from the left edge and the second coordinate is now vertical distance from the top edge.)

Determine the map page number:P = 3364 + int( 27 / 10 ) * 110 + int( 63 / 10 ) = 3590
Determine the grid location within that map page:Gx = 63 % 10 = 3 = "D"
Gy = 27 % 10 + 1 = 8
The ADC map grid location for City Hall is 3590-D8.

*Obviously, the grid boxes themselves are not actually square, as a degree of longitude is smaller in actual distance than a degree of latitude, (anywhere except at the equator). I'm not going to work out the formula now, but I'm guessing that the ratio of the grid boxes' sides is something like the cosine of the latitude. In fact, since ADC is using an equirectangular projection, (I think), where the boxes actually represent slightly curved trapezoids on the earth, they theoretically have the opportunity to ever-so-slightly change the width of the map on each page, keeping the vertical dimension constant, of course, and thus present an even more accurate representation. (Granted, I'm really splitting hairs at this scale level, about a half a degree in each direction across the whole map book!)

edens

Previous post Next post
Up