Section courante

A propos

Section administrative du site

 Langage  Elément  Programmation  Annexe  Aide 
ABAP/4
Ada
Assembleur
Assembly & bytecode
ASP (Active Server Pages)
Basic
C
C++
C# (C Sharp)
Cobol
ColdFusion
Fortran
HTML
Java
JavaScript
LISP
Logo
LotusScript
Oberon
Pascal
Perl
PHP
PL/1
Prolog
Python
Rebol
REXX
Ruby
SAS
NoSQL
SQL
Swift
X++ (Axapta)
GNAT
SMALLAda
VHDL
Assembleur 370
Assembleur 1802
Assembleur 4004
Assembleur 6502
Assembleur 6800
Assembleur 68000
Assembleur 8080 et 8085
Assembleur 8089
Assembleur 80x86
Assembleur AGC4
Assembleur ARM
Assembleur DPS 8000
Assembleur i860
Assembleur Itanium
Assembleur MIPS
Assembleur PDP-11
Assembleur PowerPC
Assembleur RISC-V
Assembleur SPARC
Assembleur SuperH
Assembleur UNIVAC I
Assembleur VAX
Assembleur Z80
Assembleur Z8000
Assembleur z/Architecture
ASSEMBLER/MONITOR 64
Micol Assembler
GFA Assembler
A86
MASM (Macro Assembler)
TASM (Turbo Assembler)
CIL
Jasmin
LLVM
MSIL
Parrot
P-Code (PCode)
SWEET16
G-Pascal
ASP 1.0
ASP 2.0
ASP 3.0
ASP.NET
ASP.NET Core
ABasiC (Amiga)
Adam SmartBASIC
Altair BASIC
AmigaBASIC (Amiga)
AMOS Basic (Amiga)
Atari Basic (Atari 400, 600 XL, 800, 800XL)
Basic Apple II (Integer BASIC/APPLESOFT)
Basic Commodore 64 (CBM-BASIC)
Basic Commodore 128 (BASIC 7.0)
Basic Commodore VIC-20 (CBM-BASIC 2.0)
Basic Coco 1 (Color Basic)
Basic Coco 2 (Extended Color Basic)
Basic Coco 3 (Extended Color Basic 2.0)
BASICA (PC DOS)
Basic Pro
BBC BASIC
Blitz BASIC (Amiga)
DarkBASIC
Dartmouth BASIC
GFA-Basic (Atari ST/Amiga)
GWBASIC (MS-DOS)
Liberty BASIC
Locomotive BASIC (Amstrad CPC)
MSX-Basic
Omikron Basic (Atari ST)
Oric Extended Basic
Power Basic
Quick Basic/QBasic (MS-DOS)
Sinclair BASIC (ZX80, ZX81, ZX Spectrum)
ST BASIC (Atari ST)
Turbo Basic
Vintage BASIC
VBScript
Visual Basic (VB)
Visual Basic .NET (VB .NET)
Visual Basic pour DOS
Yabasic
BeckerBASIC
SIMONS' BASIC
Basic09 d'OS-9
Disk Extended Color Basic
Basic09 d'OS-9
Disk Extended Color Basic
Access
Excel
Visual Basic pour Windows
Visual Basic .NET pour Windows
C Shell Unix (csh)
C pour Amiga
C pour Atari ST
C pour DOS
C pour Falcon030
C pour GEMDOS (Atari ST)
C pour Linux
C pour PowerTV OS
C pour OS/2
C pour Unix
C pour Windows
Aztec C
CoCo-C
GNU C
HiSoft C
IBM C/2
Introl-C
Lattice C
Microsoft C
MinGW C
MSX-C
Open Watcom C
OS-9 C Compiler
Pure C
Quick C
Turbo C
HiSoft C for Atari ST
HiSoft C for CP/M (Amstrad CPC)
C++ pour OS/2
C++ pour Windows
Borland C++
C++Builder
IBM VisualAge C++
Intel C++
MinGW C++
Open Watcom C++
Symantec C++
Turbo C++
Visual C++
Visual C++ .NET
Watcom C++
Zortech C++
C# (C Sharp) pour Windows
Apple III Cobol
Microsoft Cobol
BlueDragon
Lucee
OpenBD
Railo
Smith Project
Microsoft Fortran
WATFOR-77
CSS
FBML
Open Graph
SVG
XML
XSL/XSLT
LESS
SASS
GCJ (GNU)
JSP
Jython
Visual J++
Node.js
TypeScript
AutoLISP
ACSLogo
LotusScript pour Windows
Amiga Oberon
Oberon .NET
Apple Pascal
Delphi/Kylix/Lazarus
Free Pascal
GNU Pascal
HighSpeed Pascal
IBM Personal Computer Pascal
Lisa Pascal
Maxon Pascal
MPW Pascal
OS-9 Pascal
OSS Personal Pascal
Pascal-86
Pascal du Cray Research
Pascal/VS
Pascal-XT
PURE Pascal
QuickPascal
RemObjets Chrome
Sun Pascal
THINK Pascal
Tiny Pascal (TRS-80)
Turbo Pascal
UCSD Pascal
VAX Pascal
Virtual Pascal
Turbo Pascal for CP/M-80
Turbo Pascal for DOS
Turbo Pascal for Macintosh
Turbo Pascal for Windows
CodeIgniter (Cadre d'application)
Drupal (Projet)
Joomla! (Projet)
Phalanger (PHP .NET)
phpBB (Projet)
Smarty (balise)
Twig (balise)
Symfony (Cadre d'application)
WordPress (Projet)
Zend (Cadre d'application)
PL360
PL/M-80
PL/M-86
Turbo Prolog
CPython
IronPython
Jython
PyPy
AREXX
Regina REXX
JMP
Btrieve
Cassandra
Clipper
CouchDB
dBASE
Hbase
Hypertable
MongoDB
Redis
Access
BigQuery
DB2
H2
Interbase
MySQL
Oracle
PostgreSQL
SAP HANA
SQL Server
Sybase
U-SQL
Remarque
Opérateur
Conditionnel
Tableur (chiffrier électronique)
Type de données
Référence
Bonjour
Astronomie
Biochimie
Fichier
Géographie
Géométrie
Histoire
Mathématique
Médicale
Météorologie
Océanographie
Sport
Temps
Trigonométrie
Validation
Phase lunaire
Calcul du calcium corrigé
Lecture d'un fichier texte séquentiel
Distance en Km entre deux longitudes et latitudes
Aire d'un cercle
Aire d'une surface de prisme rectangulaire
Aire d'un triangle
Distance entre deux points
Chiffre romain
Ackermann
Exp
Factoriel
Fibonacci
Log
Nombre premier
Odd
Random
Sqrt
Triangle Pascal
Hauteur utérine
Unité de mesure
Fréquence des vagues
Hockey
Année bissextile
Calendrier
Date de la Pâque
ArcCos
ArcSin
Atn/ATan/ArcTan/ArcTangente
Cos
Sin
Courriel
Bibliographie
Préface
Notes légal
Dictionnaire
Recherche

Une des fonctions les plus communes de la géographie et des systèmes modernes, c'est le calcul de la distance géographique entre deux coordonnées de Longitude et de Latitude. Il n'y a aucune nécessité de grande connaissance en trigonométrie pour arriver à se genre de calcul dans le format qu'on le souhaite, Km, Miles ou Miles Nautiques. Ainsi, si vous savez les coordonnéss suivantes :

Ville Latitude Longitude
Montréal 45 31N 73 34O
Paris 48 50N 2 20E

A l'aide du code source LotusScript suivant, vous trouvez la réponse que vous souhaitez :

  1. Sub Main
  2.      Print "Distance entre Montréal et Paris en Km: " + Str$(CoordToDeltaKm(45, 31, "N", 73, 34, "O", 48, 50, "N", 2, 20, "E"))
  3.      Print "Distance entre Montréal et Paris en Miles: " + Str$(CoordToDeltaStatuteMiles(45, 31, "N", 73, 34, "O", 48, 50, "N", 2, 20, "E"))
  4.      Print "Distance entre Montréal et Paris en Miles Nautique: " + Str$(CoordToDeltaNauticalMiles(45, 31, "N", 73, 34, "O", 48, 50, "N", 2, 20, "E")) 
  5. End Sub
  6.  
  7. Function CoordToDeltaKm( _
  8. Byval Q1Latitude As Double, Byval Q1LatiDeg As Double, Byval Q1LatiDirection As String, _
  9. Byval Q1Longitude As Double, Byval Q1LongDeg As Double, Byval Q1LongDirection As String, _
  10. Byval Q2Latitude As Double, Byval Q2LatiDeg As Double, Byval Q2LatiDirection As String, _
  11. Byval Q2Longitude As Double, Byval Q2LongDeg As Double, Byval Q2LongDirection As String) As Double
  12.      Dim a1, b1, a2, b2, RawDelta As Double
  13.      a1 = (Q1Latitude + (Q1LatiDeg / 60)) * Pi / 180
  14.      If Q1LatiDirection = "N" Then
  15.           a1 = -a1
  16.      End If
  17.      b1 = (Q1Longitude + (Q1LongDeg / 60)) * Pi / 180
  18.      If Q1LongDirection = "O" Then
  19.           b1 = -b1
  20.      End If
  21.      a2 = (Q2Latitude + (Q2LatiDeg / 60)) * Pi / 180
  22.      If Q2LatiDirection = "N" Then
  23.           a2 = -a2
  24.      End If
  25.      b2 = (Q2Longitude + (Q2LongDeg / 60)) * Pi / 180
  26.      If Q2LongDirection = "O" Then
  27.           b2 = -b2
  28.      End If
  29.      RawDelta = Acos(Cos(a1) * Cos(b1) * Cos(a2) * Cos(b2) + Cos(a1) * Sin(b1) * Cos(a2) * Sin(b2) + Sin(a1) * Sin(a2))
  30.      CoordToDeltaKm = RawDelta * 6378.0
  31. End Function
  32.  
  33. Function CoordToDeltaNauticalMiles( _
  34. Byval Q1Latitude As Double, Byval Q1LatiDeg As Double, Byval Q1LatiDirection As String, _
  35. Byval Q1Longitude As Double, Byval Q1LongDeg As Double, Byval Q1LongDirection As String, _
  36. Byval Q2Latitude As Double, Byval Q2LatiDeg As Double, Byval Q2LatiDirection As String, _
  37. Byval Q2Longitude As Double, Byval Q2LongDeg As Double, Byval Q2LongDirection As String) As Double
  38.      Dim a1, b1, a2, b2, RawDelta As Double
  39.      a1 = (Q1Latitude + (Q1LatiDeg / 60)) * Pi / 180
  40.      If Q1LatiDirection = "N" Then
  41.           a1 = -a1
  42.      End If
  43.      b1 = (Q1Longitude + (Q1LongDeg / 60)) * Pi / 180
  44.      If Q1LongDirection = "O" Then
  45.           b1 = -b1
  46.      End If
  47.      a2 = (Q2Latitude + (Q2LatiDeg / 60)) * Pi / 180
  48.      If Q2LatiDirection = "N" Then
  49.           a2 = -a2
  50.      End If
  51.      b2 = (Q2Longitude + (Q2LongDeg / 60)) * Pi / 180
  52.      If Q2LongDirection = "O" Then
  53.           b2 = -b2
  54.      End If
  55.      RawDelta = Acos(Cos(a1) * Cos(b1) * Cos(a2) * Cos(b2) + Cos(a1) * Sin(b1) * Cos(a2) * Sin(b2) + Sin(a1) * Sin(a2))
  56.      CoordToDeltaNauticalMiles = RawDelta * 3443.9
  57. End Function 
  58.  
  59. Function CoordToDeltaStatuteMiles( _
  60. Byval Q1Latitude As Double, Byval Q1LatiDeg As Double, Byval Q1LatiDirection As String, _
  61. Byval Q1Longitude As Double, Byval Q1LongDeg As Double, Byval Q1LongDirection As String, _
  62. Byval Q2Latitude As Double, Byval Q2LatiDeg As Double, Byval Q2LatiDirection As String, _
  63. Byval Q2Longitude As Double, Byval Q2LongDeg As Double, Byval Q2LongDirection As String) As Double
  64.      Dim a1, b1, a2, b2, RawDelta As Double
  65.      a1 = (Q1Latitude + (Q1LatiDeg / 60)) * Pi / 180
  66.      If Q1LatiDirection = "N" Then
  67.           a1 = -a1
  68.      End If
  69.      b1 = (Q1Longitude + (Q1LongDeg / 60)) * Pi / 180
  70.      If Q1LongDirection = "O" Then
  71.           b1 = -b1
  72.      End If
  73.      a2 = (Q2Latitude + (Q2LatiDeg / 60)) * Pi / 180
  74.      If Q2LatiDirection = "N" Then
  75.           a2 = -a2
  76.      End If
  77.      b2 = (Q2Longitude + (Q2LongDeg / 60)) * Pi / 180
  78.      If Q2LongDirection = "O" Then
  79.           b2 = -b2
  80.      End If
  81.      RawDelta = Acos(Cos(a1) * Cos(b1) * Cos(a2) * Cos(b2) + Cos(a1) * Sin(b1) * Cos(a2) * Sin(b2) + Sin(a1) * Sin(a2))
  82.      CoordToDeltaStatuteMiles = RawDelta * 3963.1
  83. End Function

on obtiendra le résultat suivant :

Distance entre Montréal et Paris en Km: 5510.16761889
Distance entre Montréal et Paris en Miles: 3423.85470217
Distance entre Montréal et Paris en Miles Nautique: 2975.30044884


PARTAGER CETTE PAGE SUR
Dernière mise à jour : Dimanche, le 18 janvier 2015