Skip to content

Commit 59c92f7

Browse files
committed
Fixed name of unittest dir
1 parent 131e63e commit 59c92f7

File tree

8 files changed

+174
-106
lines changed

8 files changed

+174
-106
lines changed

README.md

Lines changed: 174 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# Mapcode Library for C/C++
22

3-
Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
3+
[![License](http://img.shields.io/badge/license-APACHE2-blue.svg)]()
4+
5+
**Copyright (C) 2014-2016 Stichting Mapcode Foundation (http://www.mapcode.com)**
46

5-
----
67

78
**Online documentation: http://mapcode-foundation.github.io/mapcode-cpp/**
89

@@ -12,21 +13,24 @@ Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
1213

1314
The directory 'mapcodelib' contains the files:
1415

15-
mapcoder.h <-- Header file with method prototypes and defines for caller.
16-
mapcoder.c
17-
basics.h
16+
mapcodelib/
17+
mapcoder.h <-- Header file with method prototypes and defines for caller.
18+
mapcoder.c
19+
basics.h
1820

19-
mapcode_fastencode.h <-- include unless FAST_ENCODE is undefined
20-
mapcode_fastalpha.h <-- needed only if FAST_ALPHA is defined
21+
mapcode_fastencode.h <-- include unless FAST_ENCODE is undefined
22+
mapcode_fastalpha.h <-- needed only if FAST_ALPHA is defined
2123

22-
mapcode_countrynames.h <-- optional array with english territory names, including official names
23-
mapcode_countrynames_short.h <-- optional array with english territory names
24+
mapcode_countrynames.h <-- optional array with english territory names, including official names
25+
mapcode_countrynames_short.h <-- optional array with english territory names
2426

2527
Together these provide routine to encode/decode Mapcodes.
2628

2729
Documentation, including example snippets of C source code, can be found in
2830

29-
mapcode_library.doc (Microsoft Word format).
31+
docs/
32+
mapcode_library_c.pdf <-- PDF format.
33+
mapcode_library_c.doc <-- Microsoft Word format.
3034

3135
A unit test can be found in the unittest\ subdirectory.
3236
Compile and run unittest\unittest/c to see if the library performs as expected.
@@ -57,169 +61,226 @@ To build the original Mapcode tool, execute:
5761

5862
For help, simply execute the binary file 'mapcode' without no arguments.
5963
This tool provides a rather extensive command-line interface to encode and
60-
decode Mapcodes.
64+
decode Mapcodes.
6165

66+
This produces the following help text:
67+
68+
MAPCODE (version 2.2.2)
69+
Copyright (C) 2014-2015 Stichting Mapcode Foundation
70+
71+
Usage:
72+
mapcode [-d| --decode] <default-territory> <mapcode> [<mapcode> ...]
73+
74+
Decode a mapcode to a lat/lon. The default territory code is used if
75+
the mapcode is a shorthand local code
76+
77+
mapcode [-e[0-8] | --encode[0-8]] <lat:-90..90> <lon:-180..180> [territory]>
78+
79+
Encode a lat/lon to a mapcode. If the territory code is specified, the
80+
encoding will only succeeed if the lat/lon is located in the territory.
81+
You can specify the number of additional digits, 0, 1 or 2 (default 0)
82+
for high-precision mapcodes.
83+
84+
mapcode [-b[XYZ] | --boundaries[XYZ]] [<extraDigits>]
85+
mapcode [-g[XYZ] | --grid[XYZ]] <nrOfPoints> [<extraDigits>]
86+
mapcode [-r[XYZ] | --random[XYZ]] <nrOfPoints> [<extraDigits>] [<seed>]
87+
88+
Create a test set of lat/lon pairs based on the mapcode boundaries database
89+
as a fixed 3D grid or random uniformly distributed set of lat/lons with their
90+
(x, y, z) coordinates and all mapcode aliases.
91+
92+
<extraDigits>: 0-8; specifies additional accuracy, use 0 for standard.
93+
<seed> is an optional random seed, use 0 for arbitrary>.
94+
(You may wish to specify a specific seed to regenerate test cases).
95+
96+
The output format is:
97+
<number-of-aliases> <lat-deg> <lon-deg> [<x> <y> <z>]
98+
<territory> <mapcode> (repeated 'number-of-aliases' times)
99+
(empty lines and next record)
100+
Ranges:
101+
number-of-aliases : >= 1
102+
lat-deg, lon-deg : [-90..90], [-180..180]
103+
x, y, z : [-1..1]
104+
105+
The lat/lon pairs will be distributed over the 3D surface of the Earth
106+
and the (x, y, z) coordinates are placed on a sphere with radius 1.
107+
The (x, y, z) coordinates are primarily meant for visualization of the data set.
108+
109+
Example:
110+
mapcode -g 100 : produces a grid of 100 points as lat/lon pairs
111+
mapcode -gXYZ 100 : produces a grid of 100 points as (x, y, z) sphere coordinates)
112+
113+
Notes on the use of stdout and stderr:
114+
stdout: used for outputting 3D point data; stderr: used for statistics.
115+
You can redirect stdout to a destination file, while stderr will show progress.
116+
117+
The result code is 0 when no error occurred, 1 if an input error occurred and 2
118+
if an internal error occurred.
62119

63120
# Release Notes
64121

65-
* 2.2.2
122+
### 2.2.2
66123

67-
Removed minor warnings from CLion inspections.
68-
69-
* 2.2.1
124+
* Removed minor warnings from CLion inspections.
70125

71-
Solved 1-microdegree gap in a few spots on Earth, noticable now extreme precision is possible.
126+
### 2.2.1
72127

73-
* 2.1.5
128+
* Solved 1-microdegree gap in a few spots on Earth, noticable now extreme precision is possible.
74129

75-
Added stricter unit tests.
130+
### 2.1.5
76131

77-
* 2.1.4
132+
* Added stricter unit tests.
78133

79-
Added `maxErrorInMetersz` to API.
80-
81-
Moved recode logic into decoder.
82-
83-
Adjusted unit test.
134+
### 2.1.4
84135

85-
* 2.1.3
136+
* Added `maxErrorInMetersz` to API.
86137

87-
Added useful routine `DistanceInMeters` to API.
138+
* Moved recode logic into decoder.
139+
140+
* Adjusted unit test.
88141

89-
* 2.1.2
142+
### 2.1.3
90143

91-
Rewrote fraction floating points to integer arithmetic.
144+
* Added useful routine `DistanceInMeters` to API.
92145

93-
* 2.1.1
146+
### 2.1.2
94147

95-
Added `unittest/` which can be compiled and executed to check
96-
if the mapcode library performs as expected.
148+
* Rewrote fraction floating points to integer arithmetic.
97149

98-
* 2.1.0
150+
### 2.1.1
99151

100-
Fixes floating point inaccuracy (prevent `encode(decode(M)) != M`).
152+
* Added `unittest/` which can be compiled and executed to check
153+
if the mapcode library performs as expected.
101154

102-
* 2.0.3
155+
### 2.1.0
103156

104-
Added `#define FAST_ALPHA` for faster alphacode string recognition.
157+
* Fixes floating point inaccuracy (prevent `encode(decode(M)) != M`).
105158

106-
* 2.0.2.4
159+
### 2.0.3
107160

108-
Added point structs to source.
161+
* Added `#define FAST_ALPHA` for faster alphacode string recognition.
109162

110-
* 2.0.2.3
163+
### 2.0.2.4
111164

112-
Cleaned up source.
165+
* Added point structs to source.
113166

114-
* 2.0.2.2
167+
### 2.0.2.3
115168

116-
Cleaned up source.
169+
* Cleaned up source.
117170

118-
* 2.0.2.1
171+
### 2.0.2.2
119172

120-
Cleaned up source, removed legacy code.
121-
122-
Renamed `dividemaps.h` to `mapcode_fast_encode.h`.
123-
124-
Improved `convertToRoman` and `convertToAlphabet` to trim and skip leading territory.
173+
* Cleaned up source.
125174

126-
Rolled back 2.0.2 fix for letters "i" and "o" in Hindi, Bengali, Tibetan and Gurmukhi.
175+
### 2.0.2.1
127176

128-
* 2.0.2
177+
* Cleaned up source, removed legacy code.
129178

130-
Speed-up of encoding (4 times faster than 2.0.1).
179+
* Renamed `dividemaps.h` to `mapcode_fast_encode.h`.
131180

132-
Added optional `mapcode_countrynames.h` (with the English short names, formal names,
133-
and name variants of all territories) and `mapcode_countrynames_short.h` (with only
134-
the short English names and name variants.
181+
* Improved `convertToRoman` and `convertToAlphabet` to trim and skip leading territory.
135182

136-
Stricter processing of high-precision letters (now fails on illegal high-precision
137-
letters, which includes the letter Z).
183+
* Rolled back 2.0.2 fix for letters "i" and "o" in Hindi, Bengali, Tibetan and Gurmukhi.
138184

139-
Fix for letters "i" and "o" in Hindi, Bengali, Tibetan and Gurmukhi;
185+
### 2.0.2
140186

141-
Fix for some unrecognized aliases in `convertTerritoryIsoNameToCode()`.
142-
143-
* 2.0.1
187+
* Speed-up of encoding (4 times faster than 2.0.1).
144188

145-
Removed compiler warnings.
146-
147-
* 2.0.0
189+
* Added optional `mapcode_countrynames.h` (with the English short names, formal names,
190+
and name variants of all territories) and `mapcode_countrynames_short.h` (with only
191+
the short English names and name variants.
148192

149-
Support for high-precision mapcodes, with up to 8 character extensions (up to 10 micron accuracy).
150-
151-
Fixes to the data rectangles (primarily intended for ISO proposal), see Word document for details.
193+
* Stricter processing of high-precision letters (now fails on illegal high-precision
194+
letters, which includes the letter Z).
152195

153-
* 1.50.1
196+
* Fix for letters "i" and "o" in Hindi, Bengali, Tibetan and Gurmukhi;
154197

155-
Bug fix for state IN-DD (in India).
156-
157-
If the executable name contains "debug", the self checking mechanism is activated. Note, however, that
158-
this feature is under construction and produces false negative for certain decodes.
159-
160-
* 1.50
198+
* Fix for some unrecognized aliases in `convertTerritoryIsoNameToCode()`.
199+
200+
### 2.0.1
161201

162-
Major release. This version is not backwards compatible with mapcode 1.4x: is has dropped support for
163-
Antartica AT0-8 codes and has a changed (improved) way of dealing with the Greek alphabet.
202+
* Removed compiler warnings.
203+
204+
### 2.0.0
164205

165-
Added 22-chararcter post-processing of all-digit mapcodes for the Greek alphabet.
206+
* Support for high-precision mapcodes, with up to 8 character extensions (up to 10 micron accuracy).
166207

167-
Retired legacy aliases EAZ and SKM, AU-QL, AU-TS, AU-NI and AU-JB.
208+
* Fixes to the data rectangles (primarily intended for ISO proposal), see Word document for details.
168209

169-
Retired legacy Antarctica claims AT0 through AT8.
170-
171-
* 1.41.1
210+
### 1.50.1
211+
212+
* Bug fix for state IN-DD (in India).
213+
214+
* If the executable name contains `debug`, the self checking mechanism is activated. Note, however, that
215+
this feature is under construction and produces false negative for certain decodes.
216+
217+
### 1.50
218+
219+
* Major release. This version is not backwards compatible with mapcode 1.4x: is has dropped support for
220+
Antartica AT0-8 codes and has a changed (improved) way of dealing with the Greek alphabet.
172221

173-
Bugfix for “utility/mapcode” utility (-d option was case sensitive).
222+
* Added 22-chararcter post-processing of all-digit mapcodes for the Greek alphabet.
174223

175-
* 1.41
224+
* Retired legacy aliases EAZ and SKM, AU-QL, AU-TS, AU-NI and AU-JB.
176225

177-
Added the India state Telangana (IN-TG), until 2014 a region in Adhra Pradesh.
226+
* Retired legacy Antarctica claims AT0 through AT8.
227+
228+
### 1.41.1
178229

179-
Fixed a problem with the "extraDigits" parameter of the “utility/mapcode" utility (maximum digits is 2, not 3).
230+
* Bugfix for `utility/mapcode` utility (`-d` option was case sensitive).
180231

181-
* 1.40
232+
### 1.41
182233

183-
Added extraDigits parameter to allow high-precision mapcodes to be generated by the “utility/mapcode” utility.
234+
* Added the India state Telangana (IN-TG), until 2014 a region in Adhra Pradesh.
184235

185-
* 1.33
236+
* Fixed a problem with the `extraDigits` parameter of the `utility/mapcode` utility (maximum digits is 2, not 3).
186237

187-
Fix to not remove valid results just across the edge of a territory.
188-
Improved interface readability and renamed methods to more readable forms.
238+
### 1.40
189239

190-
* 1.32
240+
* Added extraDigits parameter to allow high-precision mapcodes to be generated by the `utility/mapcode` utility.
191241

192-
Added encodeLatLonToSingleMapcode(); fixed 1.29 so no country-wide alternative
193-
is produced in edge cases; prevent FIJI failing to decode at exactly 180 degrees.
242+
### 1.33
194243

195-
* 1.31
244+
* Fix to not remove valid results just across the edge of a territory.
196245

197-
Added compareWithMapcodeFormat().
246+
* Improved interface readability and renamed methods to more readable forms.
198247

199-
* 1.30
248+
### 1.32
200249

201-
IUpdated the documentation and extended it with examples and suggestions.
250+
* Added `encodeLatLonToSingleMapcode()`
202251

203-
* 1.29
252+
* Fixed 1.29 so no country-wide alternative
253+
is produced in edge cases; prevent FIJI failing to decode at exactly 180 degrees.
204254

205-
Also generate country-wide alternative mapcodes for states.
255+
### 1.31
206256

207-
* 1.28
257+
* Added `compareWithMapcodeFormat()`.
208258

209-
Bug fix for the needless generation of 7-letter alternatives to short mapcodes
210-
in large states in India.
259+
### 1.30
211260

212-
* 1.27
261+
* IUpdated the documentation and extended it with examples and suggestions.
213262

214-
Improved (faster) implementation of the function isInArea.
263+
### 1.29
215264

216-
* 1.26
265+
* Also generate country-wide alternative mapcodes for states.
217266

218-
Added alias OD ("Odisha") for indian state OR ("Orissa").
267+
### 1.28
219268

220-
* 1.25
269+
* Bug fix for the needless generation of 7-letter alternatives to short mapcodes
270+
in large states in India.
271+
272+
### 1.27
273+
274+
* Improved (faster) implementation of the function `isInArea`.
275+
276+
### 1.26
277+
278+
* Added alias OD ("Odisha") for indian state OR ("Orissa").
279+
280+
### 1.25
281+
282+
* Initial release to the public domain.
221283

222-
Initial release to the public domain.
223284

224285
# License
225286

@@ -235,3 +296,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
235296
See the License for the specific language governing permissions and
236297
limitations under the License.
237298

299+
300+
# Acknowledgements
301+
302+
Development of the C/C++ version of the Mapcode Library is kindly sponsored by
303+
[**JetBrains**](https://www.jetbrains.com).
304+
305+
[![CLion](docs/logo_CLion.png)](https://www.jetbrains.com/clion/)

docs/logo_CLion.png

6.46 KB
Loading

docs/mapcode_library_c.pdf

289 KB
Binary file not shown.
File renamed without changes.

0 commit comments

Comments
 (0)