Personal Computer News


London

 
Author: David Lewis
Published in Personal Computer News #074

Save time driving on the streets of London with this short program from David Lewis.

Epson HX20: London By Short Cuts

Save time driving on the streets of London with this short program from David Lewis

The program presented here, London, prints out the shortest route between any two points in Greater London.

It is used in conjunction with the Geographers' Master Atlas of Greater London, which covers an area of more than 2,000 square miles bounded by Potters Bar, Grays, Coulsdon and Windsor.

The map references for the squares of origin and of destination are entered as an eight-digit code, e.g. 27K247J1 (Southgate to Heathrow Airport. Ignore page numbers, and if there is no index number after the letter in the map reference use zero.

You may also enter the description of address of origin and destination, which will then be printed out, or you may instead enter Return. London will print out the approximate distance in miles and kilometres between the two points. It will then print the map references for each square of the Atlas (including those for both points) through which you should pass when taking the shortest route.

It is then a relatively simple task to plan your car journey, using the Atlas. The effect is as if you had the pages of the Atlas pinned on the wall as a composite chart measuring some seven feet by eleven feet, for planning the straightest route with map pins and cotton.

If you have a cassette player in the car, it can sometimes save time over a long, unfamiliar journey to record the details of the route and play the tape as you go along.

Program Notes

40-50 Switches control to the subroutine whose name has been assigned to the string variable 'Z'
70 Converts alphanumeric map reference to a number (allowing for non-use of 1 and 0 in Atlas)
90-120 For a series of diagonal 'steps' from origin to destination, calculate distance across (west-east) and down (north-south), e.g. one map square across and .75 map square down, converts resultant numbers to alphanumeric map references, and prints
140-260 Main program procedure.
140 Input origin and destination addresses (on 24-column screen to facilitate formatting for micro-printer)
150 Input both map references as eight (=4+4) characters
160-180 Converts origin and destination map references to numbers and assigns variables to them
190 Prints origin and destination addresses or place names (unless null strings were entered)
200 Calculates west-east and north-south distances in map squares between origin and destination, and anticipates 'negative' directions (south-north and east-west)
210-220 Uses Pythagoras' theorem to calculate true (diagonal) distance in length equivalent to map squares, converts to and prints miles and kilometers
230 Prints map reference of origin
240 Divides west-east and north-south distances into units of distinct lengths, so that there are the same number of units in each dimension, assigns unity to length of greater unit and the appropriate fraction to that of the lesser unit
250 Negative values of set units for SN and EW directions
260 Uses 90-120 subroutine to calculate and print each diagonal step, and feeds paper

David Lewis