@@ -15,35 +15,34 @@ The directory 'mapcodelib' contains the files:
1515
1616 mapcodelib/
1717 mapcoder.h <-- Header file with method prototypes and defines for caller.
18- mapcoder.c
19- basics.h
18+ mapcoder.c <-- Implementation of mapcode routines.
19+ internal_*.h <-- Internal implementataion details for library.
2020
21- mapcode_fastencode.h <-- include unless FAST_ENCODE is undefined
22- mapcode_fastalpha.h <-- needed only if FAST_ALPHA is defined
23-
24- mapcode_countrynames.h <-- optional array with english territory names, including official names
25- mapcode_countrynames_short.h <-- optional array with english territory names
21+ mapcode_alphabets.h <-- Enumeration of supported alphabets (or scripts).
22+ mapcode_territories.h <-- Enumeration of supported territories.
23+
24+ mapcode_legacy.h <-- Courtesy support for legacy calls, may be deprecated in future.
2625
2726Together these provide routine to encode/decode Mapcodes.
2827
2928Documentation, including example snippets of C source code, can be found in
3029
3130 docs/
3231 mapcode_library_c.pdf <-- PDF format.
33- mapcode_library_c.doc <-- Microsoft Word format.
32+ mapcode_library_c.docx <-- Microsoft Word format.
3433
35- A unit test can be found in the ` test ` subdirectory.
36- Compile and run ` unittest.c ` to see if the library performs as expected.
37- Check the ` README.md ` file in ` test ` to see how you can compile it/
34+ A unit test can be found in the ` test ` subdirectory. Compile and run ` unittest.c ` to see
35+ if the library performs as expected:
3836
39- Also see www.mapcode.com for background and reference materials.
37+ cd mapcodelib
38+ gcc -O -c mapcoder.c
39+ cd ../test
40+ gcc -O unittest.c -lm -lpthread -o unittest ../mapcodelib/mapcoder.o
41+ ./unittest
4042
41- Note: this version may be restricted to a particular area of the Earth!
42- In that case, basics.h will state a version number of the for:
43+ Check the ` README.md ` in directory ` test ` for more information.
4344
44- #define mapcode_cversion "1.2xxx"
45-
46- where "xxx" states the geographical limitation.
45+ Also see http://www.mapcode.com for background and reference materials.
4746
4847
4948## A Real-Life Example, The 'mapcode' Codec Tool: ` utility/ `
@@ -53,8 +52,10 @@ of how to use the library.
5352
5453To build the original Mapcode tool, execute:
5554
56- cd utility
57- gcc -O mapcode.cpp -o mapcode
55+ cd mapcodelib
56+ gcc -O -c mapcoder.c
57+ cd ../utility
58+ gcc -O mapcode.cpp -o mapcode ../mapcodelib/mapcoder.o
5859
5960For help, simply execute the binary file 'mapcode' without no arguments.
6061This tool provides a rather extensive command-line interface to encode and
@@ -66,29 +67,29 @@ This produces the following help text:
6667 Copyright (C) 2014-2016 Stichting Mapcode Foundation
6768
6869 Usage:
69- ./ mapcode [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]
70+ mapcode [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]
7071
7172 Decode a mapcode to a lat/lon. The default territory code is used if
7273 the mapcode is a shorthand local code
7374
74- ./ mapcode [-e[0-8] | --encode[0-8]] <lat:-90..90> <lon:-180..180> [territory]>
75+ mapcode [-e[0-8] | --encode[0-8]] <lat:-90..90> <lon:-180..180> [territory]>
7576
7677 Encode a lat/lon to a mapcode. If the territory code is specified, the
7778 encoding will only succeeed if the lat/lon is located in the territory.
7879 You can specify the number of additional digits, 0, 1 or 2 (default 0)
7980 for high-precision mapcodes.
8081
81- ./ mapcode [-t | --territories]
82+ mapcode [-t | --territories]
8283
8384 Create a full set of territories in CSV format.
8485
85- ./ mapcode [-a | --alphabets]
86+ mapcode [-a | --alphabets]
8687
8788 Create a full set of alphabet tests in CSV format.
8889
89- ./ mapcode [-b[XYZ] | --boundaries[XYZ]] [<extraDigits>]
90- ./ mapcode [-g[XYZ] | --grid[XYZ]] <nrOfPoints> [<extraDigits>]
91- ./ mapcode [-r[XYZ] | --random[XYZ]] <nrOfPoints> [<extraDigits>] [<seed>]
90+ mapcode [-b[XYZ] | --boundaries[XYZ]] [<extraDigits>]
91+ mapcode [-g[XYZ] | --grid[XYZ]] <nrOfPoints> [<extraDigits>]
92+ mapcode [-r[XYZ] | --random[XYZ]] <nrOfPoints> [<extraDigits>] [<seed>]
9293
9394 Create a test set of lat/lon pairs based on the mapcode boundaries database
9495 as a fixed 3D grid or random uniformly distributed set of lat/lons with their
@@ -112,16 +113,16 @@ This produces the following help text:
112113 The (x, y, z) coordinates are primarily meant for visualization of the data set.
113114
114115 Example:
115- ./ mapcode -g 100 : produces a grid of 100 points as lat/lon pairs
116- ./ mapcode -gXYZ 100 : produces a grid of 100 points as (x, y, z) sphere coordinates)
116+ mapcode -g 100 : produces a grid of 100 points as lat/lon pairs
117+ mapcode -gXYZ 100 : produces a grid of 100 points as (x, y, z) sphere coordinates)
117118
118119 Notes on the use of stdout and stderr:
119- stdout: used for outputting 3D point data; stderr: used for statistics.
120+ stdout: used for outputting 3D Point data; stderr: used for statistics.
120121 You can redirect stdout to a destination file, while stderr will show progress.
121122
122123 The result code is 0 when no error occurred, 1 if an input error occurred and 2
123124 if an internal error occurred.
124-
125+
125126## Compile Options for Microsoft Visual C++
126127
127128If you use ** Microsoft Visual C++** , you may need to add the following compiler directives to your build:
@@ -136,11 +137,56 @@ The Mapcode C/C++ Library has includes a number of fixed data tables, which incr
136137You may not require all of this data, so we've added some options for you to be able to reduce its
137138footprint, for example for embedded applications.
138139
140+ You can specify the define ` MAPCODE_NO_SUPPORT_ALL_LANGUAGES ` to disable support for territory names
141+ in all languages.
142+
143+ Note that English names are always supported and it's also always possible to get territory names
144+ in their locale language.
145+
146+ To add individual support support for other languages (of all territory names), use:
147+
148+ -DMAPCODE_NO_SUPPORT_ALL_LANGUAGES // If not defined, ALL languages are available.
149+ -DMAPCODE_SUPPORT_LANGUAGE_AF // Add the languages you need. The names are the
150+ -DMAPCODE_SUPPORT_LANGUAGE_AR // ISO 3166-2 character codes.
151+ -DMAPCODE_SUPPORT_LANGUAGE_BE
152+ -DMAPCODE_SUPPORT_LANGUAGE_CN
153+ -DMAPCODE_SUPPORT_LANGUAGE_CS
154+ -DMAPCODE_SUPPORT_LANGUAGE_DA
155+ -DMAPCODE_SUPPORT_LANGUAGE_DE
156+ -DMAPCODE_SUPPORT_LANGUAGE_EN
157+ -DMAPCODE_SUPPORT_LANGUAGE_ES
158+ -DMAPCODE_SUPPORT_LANGUAGE_FI
159+ -DMAPCODE_SUPPORT_LANGUAGE_FR
160+ -DMAPCODE_SUPPORT_LANGUAGE_HE
161+ -DMAPCODE_SUPPORT_LANGUAGE_HI
162+ -DMAPCODE_SUPPORT_LANGUAGE_HR
163+ -DMAPCODE_SUPPORT_LANGUAGE_ID
164+ -DMAPCODE_SUPPORT_LANGUAGE_IT
165+ -DMAPCODE_SUPPORT_LANGUAGE_JA
166+ -DMAPCODE_SUPPORT_LANGUAGE_KO
167+ -DMAPCODE_SUPPORT_LANGUAGE_NL
168+ -DMAPCODE_SUPPORT_LANGUAGE_NO
169+ -DMAPCODE_SUPPORT_LANGUAGE_PL
170+ -DMAPCODE_SUPPORT_LANGUAGE_PT
171+ -DMAPCODE_SUPPORT_LANGUAGE_RU
172+ -DMAPCODE_SUPPORT_LANGUAGE_SV
173+ -DMAPCODE_SUPPORT_LANGUAGE_SW
174+ -DMAPCODE_SUPPORT_LANGUAGE_TR
175+ -DMAPCODE_SUPPORT_LANGUAGE_UK
176+
177+ The list of support languages may grow over time.
178+
139179## Release Notes
140180
141181### 2.5.2
142182
143- * Added locale support.
183+ * Added unit test for floating point error with code "40822.schol".
184+
185+ * Added locale support.
186+
187+ * Added many languages.
188+
189+ * Hardened unit tests.
144190
145191### 2.5.1
146192
0 commit comments