42 views

Uploaded by edyshor_gmail

Old visual foxpro publication - found in public domain

- Siddhanta Shiromani Ch 7 Translated
- Noção de Latitude
- eeo410-assessment-2-planner
- Tilt and Azimuth Methodology
- 9_9682-Part3
- Our World Longtitude and Latitude
- n 43-48_The First Locality of Amanita Argentea Huijsman
- Termly Overview Term 4
- Capt. Dela Cuesta.ppt
- GEOMATICS BEST PRACTICES IN SAKA INDONESIA PANGKAH LIMITED (CASE STUDY: UJUNG PANGKAH PIPELINE INTEGRITY)
- utmconveter-380
- ch1 1-worksheet
- Latitudes and Longitudes
- Panigan River
- Paper - (Suhayl 02) a Universal Plate for Timekeeping by the Stars by Habash Al-Hasib Text - Francois Charette - 2001
- Basic_Geomatics_Marío Gomarasca.pdf
- unit 1 day 2 geo themes 1-3
- Chapter 1 Human Geography Review
- How Obtain Map Publ
- GA Conf08Taylor

You are on page 1of 2

Seite 1 von 2

Doug Dodge

Have you ever needed to calculate the distance between two points on the globe? This function will take two points -- described in terms of longitude and latitude -- and return the distance between them in miles.

Calculating the distance between two points on the globe isn't as simple as you might first think. Before I discuss why, let me refresh your memory about longitude and latitude. Lines of latitude circle the globe. The equator, for example, is a line of latitude. A degree of latitude is the distance between two consecutive lines of latitude. Since two lines of latitude are parallel, the distance between them is always the same. Thus, a degree of latitude measured near the North Pole (such as between 88 degrees and 89 degrees) is the same as near the Equator (such as between 1 degree and 2 degrees.) A degree of latitude is always about 69 miles. On the other hand, lines of longitude run from one pole to the other. Two lines of longitude intersect at both poles -- the distance between them is 0 -- and are furthest apart at the equator, where the distance is approximately 69 miles. (The circumference of the earth is approximately 25,000 miles, and there are 360 degrees of longitude: 25,000/360 = 69.44 miles.) For example, a degree of longitude (running across the globe) in Houston, Texas, or Perth, Australia (30 degrees) is approximately equal to 59 miles, while a degree of longitude in Montreal or Venice (45 degrees latitude) is 48 miles, and in Stockholm or Anchorage, it's 34 miles. As a result, you can't simply calculate the distance between two points by calculating the number of degrees between them and then multiplying the result by a number of miles per degree. The number of miles per degree of longitude varies depending on where, latitudinally, it is. The following equation, provided by CD Light in Sandy, Utah, takes these factors into account: nDistance = ; 3958.7500 * ; ACOS(SIN(nLat1/nDegrees) * ; SIN(nLat2/nDegrees) + ; COS(nLat1/nDegrees) * ; COS(nLat2/nDegrees) * ; COS(nLon2/nDegrees - nLon1/nDegrees)) where nDegrees = 180/PI() This formula can be incorporated into a routine that calculates the distance between two points on the globe, like so: * distance.prg PARAMETERS nLat1, nLon1, nLat2, nLon2 PRIVATE nParms, nDistance STORE pcount() TO nParms STORE -1 TO nDistance nDegrees = 180/PI() IF nParms <> 4 =MESSAGEBOX( ; "Incorrect number of parameters passed.", 16) ELSE * * The following formula was adapted from the * information provided by: * * CD Light * 8861 Silverstone Way * Sandy, Utah 84093-1679 * * (801) 943-0162 * (800) 571-3914 * sales@zipinfo.com *

http://foxtalknewsletter.com/ME2/Audiences/Segments/Publications/Print.asp?Module=... 05.02.06

Print Article

Seite 2 von 2

nDistance = ; 3958.7500 * ; ACOS(SIN(nLat1/nDegrees) * ; SIN(nLat2/nDegrees) + ; COS(nLat1/nDegrees) * ; COS(nLat2/nDegrees) * ; COS(nLon2/nDegrees - nLon1/nDegrees)) ENDIF RETURN nDistance Call this routine to calculate the distance between Cairo and London like so: ? distance(30,30,52,0) 2152.7475 This function can be particularly handy when calculating the distance between ZIP codes or finding all the ZIP codes within a certain distance of a base ZIP code. For example, the following routine will perform the second function. It depends on access to a database that holds each ZIP code and its associated longitude and latitude.

* getdist.prg PARAMETERS nDist, nLat, nLon PRIVATE nRetVal STORE -1 TO nRetVal IF pcount() <> 3 = MESSAGEBOX( ; "Incorrect number of parameters passed to " ; + PROGRAM() + " - terminating", 16) ELSE SELECT ; *, distance(nLat, nLon, a.latitude, a.longitude) ; AS distance ; FROM zipcode a; WHERE distance(nLat, nLon, a.latitude, a.longitude) ; <= nDist AND ; a.latitude <> nLat AND ; a.longitude <> nLon IF _TALLY > 0 STORE 0 TO nRetVal ELSE STORE -2 TO nRetVal ENDIF ENDIF RETURN nRetVal There are two things I should mention about the SELECT command shown in the preceding code. First, the last two lines ensure that the current position isn't included in the result set. You might wish to delete these lines if you want to include that position. Second, there isn't an output destination. This is because in my application, I directed the output to a grid, as displayed in Figure 1 . Figure 1. This screen allows the user to select companies that match specific criteria, including being within a range of a designated ZIP code.

Obviously, the actual SELECT that populated this grid was more complex, needing to handle multiple conditions and bind the result to the grid. Nonetheless, the essence of the form's mechanism is contained within this routine. I hope this pair of functions proves to be useful in your library of routines.

http://foxtalknewsletter.com/ME2/Audiences/Segments/Publications/Print.asp?Module=... 05.02.06

- Siddhanta Shiromani Ch 7 TranslatedUploaded byBharath Palepu
- Noção de LatitudeUploaded bypsousa01
- eeo410-assessment-2-plannerUploaded byapi-313752230
- Tilt and Azimuth MethodologyUploaded byomidianno
- 9_9682-Part3Uploaded bymcdouk
- Our World Longtitude and LatitudeUploaded bylisa langston
- n 43-48_The First Locality of Amanita Argentea HuijsmanUploaded byRaszczyc
- Termly Overview Term 4Uploaded byAnonymous DZn3y6d8
- Capt. Dela Cuesta.pptUploaded byJerick Christian P. Dagdagan
- GEOMATICS BEST PRACTICES IN SAKA INDONESIA PANGKAH LIMITED (CASE STUDY: UJUNG PANGKAH PIPELINE INTEGRITY)Uploaded byYudi Syahnur
- utmconveter-380Uploaded byDrio Rio
- ch1 1-worksheetUploaded byapi-286833366
- Latitudes and LongitudesUploaded byHarsh Vardhan Baranwal
- Panigan RiverUploaded byArmando Basoc
- Paper - (Suhayl 02) a Universal Plate for Timekeeping by the Stars by Habash Al-Hasib Text - Francois Charette - 2001Uploaded bySinggih Satrio Wibowo
- Basic_Geomatics_Marío Gomarasca.pdfUploaded byDavid Becerra
- unit 1 day 2 geo themes 1-3Uploaded byapi-345750196
- Chapter 1 Human Geography ReviewUploaded byAlexus Ellis
- How Obtain Map PublUploaded bymkmhil
- GA Conf08TaylorUploaded byavg
- 1992 the Soviet Far East Geographical Perspectives on Development 1Uploaded byPenghan Wu
- Draft FLorida Social Studies StandardsUploaded bySherman
- UsingaGarminGPSwithPaperLandMaps ManualUploaded byMara Pedroso
- Intro to Air NavigationUploaded bySean Stephenson
- bowers socialstudies zoolessonUploaded byapi-259918676
- Waypoint List OHRID.pdfUploaded byGoce Vasilevski
- India and Global is at IonUploaded byManav Has Frikin Exams
- ch1 1-worksheetUploaded byapi-345750196
- European Cartographers and the Ottoman World 1500 - 1750Uploaded bySecu09
- 1 Intro World Reg Geog 05Uploaded byNi Ca

- FT19986_4 - Tame Your ActiveX ControlsUploaded byedyshor_gmail
- FT19984_5 - Empower ASP With Visual FoxProUploaded byedyshor_gmail
- FT19983_9 - Understanding the CommonDialog ControlUploaded byedyshor_gmail
- FT19981_5 - Play Tricks on Your MemoryUploaded byedyshor_gmail
- FT19988_10 - Using MTS to Create Multi-Tier Client Server AppsUploaded byedyshor_gmail
- FT19986_8 - Use the Microsoft Scripting Control to Script With VFPUploaded byedyshor_gmail
- FT19979_4 - Instrumenting FoxPro ApplicationsUploaded byedyshor_gmail
- FT19981_8 - SYS(1270) Object LocationUploaded byedyshor_gmail
- FT19981_2 - Creating and Obtaining a Printer Device ContextUploaded byedyshor_gmail
- FT19981_6 - Previewing a Report From an SDI ApplicationUploaded byedyshor_gmail
- FT19979_2 - Calling All WindowsUploaded byedyshor_gmail
- Laborator 1 - Tehnici de Program Are _2002Uploaded byedyshor_gmail
- Laborator 1 - Tehnici de Program Are _2002Uploaded byedyshor_gmail
- FT19977_8 - Using VFP 5.0 Top-Level FormsUploaded byedyshor_gmail
- Best Practices for Peer Code ReviewUploaded byedyshor_gmail
- FT_SampleUploaded byedyshor_gmail
- Shrediquette HowTo by W. ThielickeUploaded byedyshor_gmail
- FT19978_3 - An Editable ListboxUploaded byedyshor_gmail
- Ecrane CrmUploaded byedyshor_gmail

- RadioStack Microsoft Flight Simulator XUploaded byzeze1982
- Code y Question PaperUploaded byHeena Mittal
- Kobelco BME800HD SpecUploaded byKok Toong Fatt
- Materials and CablesUploaded byYuva Raj
- Penetration of Microwaves into AluminumUploaded byJohn Michael Williams
- THE MTI IMPROVEMENT FACTOR BY USING DOUBLE - DELAY FILTER AT TWO AND THREE PERIOD STAGGEREDUploaded byTJPRC Publications
- Bonderlube 745 EnUploaded byiwedification
- Elementary Block MethodUploaded byBoris Miranda
- Banner Mini Screen SystemUploaded byMauricio Sanchez Portilla
- Memory c128Uploaded byMario Villar Corbo
- ANSYS Platform Support Stategy and Plans December 2013Uploaded bycagrinart3576
- Tanques polyglas18-42Uploaded byDNI17909752
- Quantifying NOx for Industrial CombustionUploaded bySudhakar Rao
- ERW_1Uploaded bySachein Anand
- PID QuestionsUploaded bynivasssv
- Mvi69 Pdpmv1 User ManualUploaded bysergiojordao
- Asam BasaUploaded byFitriHdyn
- Robust Ensemble ClusteringUploaded bylogu1234
- Ansys Capabilities 14.5Uploaded byviswanathyakkala
- EMV v4.3 Book 1 ICC to Terminal Interface 2012060705394541Uploaded bySunil Shenava
- Local Search and the Evolution of Technological CapabilitiesUploaded bymirianalbertpires
- Conrete Mix Design ACI and JSCE example.(20+33 Mpa)Uploaded bynirmaljoshi
- Unisa MOM3602 Theory of Machines III Mock Exam 2015 _Preparation Practice ProblemsUploaded byDaniel Mabengo
- Electro Teh NicaUploaded byglitterintheair
- report 10Uploaded byMuhib Ullah Khan
- Chapter 1 q Worksheet01Uploaded byKhairul Anwar
- Flexible Rigid PavementsUploaded byShumank Srivastava
- Chapter 10 Radioactivity 2017Uploaded byPikachu Alsaleh
- 300 onemark wetechnologyUploaded bykavithadiksa
- Physics II Problems (91).pdfUploaded byBOSS BOSS