File: README.md

package info (click to toggle)
geographiclib 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,572 kB
  • sloc: cpp: 27,765; sh: 5,463; makefile: 695; python: 12; ansic: 10
file content (94 lines) | stat: -rw-r--r-- 3,611 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Calling the GeographicLib C++ library from Excel

You can call GeographicLib functions from Excel.  Thanks to Thomas
Warner <warnerta@gmail.com>, for showing me how.  This prescription
has only been tested for Excel running on a Windows machine.  Please
let me know if you figure out how to get this working on MacOS
versions of Excel.

Here's the overview

* Write and compile little interface routines to invoke the
  functionality you want.

* Copy the resulting DLLs to where Excel can find them.

* Write an interface script in Visual Basic.  This tells Visual Basic
  about your interfrace routines and it includes definitions of the actual
  functions you will see exposed in Excel.

Here are the step-by-step instructions for compiling and using the
sample routines given here (which solve the direct and inverse geodesic
problems and the corresponding rhumb line problems):

1. Install binary distribution for GeographicLib (either 64-bit or
   32-bit to match your version of Excel).

2. Install a recent version of cmake.

3. Start a command prompt window and run
   ```bash
   mkdir BUILD
   cd BUILD
   cmake -G "Visual Studio 16" -A x64 ..
   ```
   This configures your build.  Any of Visual Studio 14, 15, or 16
   (corresponding the VS 2015, 2017, 2019) will work.  If your Excel is
   32-bit, change `-A x64` to `-A win32`.  If necessary include `-D
   CMAKE_PREFIX_PATH=DIR` to specify where GeographicLib is installed
   (specified when you ran the GeographicLib installer).  Compile the
   interface with
   ```bash
   cmake --build . --config Release
   ```

4. Copy
   ```bash
   Release\cgeodesic.dll   # the interface routines
   Release\GeographicLib.dll  # the main GeographicLib library
   ```
   to the directory where the Excel executable lives.  You can find this
   directory by launching Excel, launching Task Manager, right-clicking on
   Excel within Task Manager and selecting Open file location.  It's
   probably something like
   ```bash
   C:\Program Files\Microsoft Office\root\Office16
   ```
   and you will probably need administrator privileges to do the copy.
   If it's in `Program Files (x86)`, then you have a 32-bit version of
   Excel and you need to compile your interface routines in 32-bit by
   specitying `-A win32` when you first run cmake.

5. Open the Excel workbook within which you would like to use the
   geodesic and rhumb routines.<br>
   Type `Alt-F11` to open Excel's Visual Basic editor.<br>
   In the left sidebar, right-click on `VBAProject (%yourworksheetname%)`
   and select Import File<br>
   Browse to `Geodesic.bas`, select it and click Open<br>
   Save your Workbook as Excel Macro-Enabled Workbook (`*.xlsm`)

6. You will now have 10 new functions available:
   * Solve the direct geodesic problem for
     ```
     lat2: geodesic_direct_lat2(lat1, lon1, azi1, s12)
     lon2: geodesic_direct_lon2(lat1, lon1, azi1, s12)
     azi2: geodesic_direct_azi2(lat1, lon1, azi1, s12)
     ```
   * Solve the inverse geodesic problem for
     ```
     s12: geodesic_inverse_s12(lat1, lon1, lat2, lon2)
     azi1: geodesic_inverse_azi1(lat1, lon1, lat2, lon2)
     azi2: geodesic_inverse_azi2(lat1, lon1, lat2, lon2)
     ```
   * Solve the direct rhumb problem for
     ```
     lat2: rhumb_direct_lat2(lat1, lon1, azi12, s12)
     lon2: rhumb_direct_lon2(lat1, lon1, azi12, s12)
     ```
   * Solve the inverse rhumb problem for
     ```
     s12: rhumb_inverse_s12(lat1, lon1, lat2, lon2)
     azi12: rhumb_inverse_azi12(lat1, lon1, lat2, lon2)
     ```
   Latitudes, longitudes, and azimuths are in degrees.  Distances are
   in meters.