(Comp.sys.handhelds) Item: 2590 by dan at Apple.COM Author: [Dan Allen] Subj: City DataBase for HP-48 (LONG: 40 KB) Keyw: cities,HP-48,navigation Date: Mon Apr 01 1991 The following programs generate random trips between cities in a database. The TRIPS command continuously generates trips until the clear key is pressed. It in turn calls CALCTRIP to display the latitude, longitude, and elevation (in feet) of the two cities, followed by the great circle distance in US miles, the difference in elevation, and a rough approximation to the heading one would go in to arrive at the destination city. The database is large, containing over 1,000 cities. They are all of the airports in the Western states (Washington, Oregon, California, Arizona, Nevada, and Utah), as well as a few other cities in the US, like Chicago, New York, etc. All of the information came from an FAA database. Your own cities are easily added, or these cities deleted. In those cities that have multiple airports, a single airport was chosen on a semi-random basis. The final item displayed is an approximate time that it would take to travel between the two cities. I chose a speed of 40 mph which compensates for the fact that the distance is great circle distance, and to drive between the two cities, one must follow roads which are not great circles. If you wish to use this for flying applications, then you could substitute a faster speed. The 40mph figure does a pretty good rough approximation of what it takes to drive at 60 mph. A second version of TRIPS, called SLOWTRIPS, is also included when memory is tight. The fast TRIPS routine puts the list of cities on the stack and picks them off of the stack, two random cities at a time. It is pretty zippy. SLOWTRIPS uses the GET function to grab a list from the city database and it is very slow. This whole file is about 41 KB, so you must have installed some extra memory to run it. Of course 40 KB of this is the city database I have included. Omit those cities that are of no interest to you and you can reduce the size of this immensely. Another routine called BFIND allows a binary search to take place for a given city name, with its data returned to the stack. Calling BFIND twice, with the source and destination names, leaves the information on the stack so you can then call CALCTRIP to determine the distance and rough time, course, etc. The format for the cities is simple: it is a list composed of other lists, one list per city. The list is sorted alphabetically by city name, so that the binary search works. Each city has the following information associated with it in this database: City name (string) Latitude (real) Longitude (real) Elevation (integer) Enjoy! Dan Allen Apple Computer