Skip to content

Commit ffe20f3

Browse files
committed
Development for 1.50
1 parent 9a62279 commit ffe20f3

File tree

5 files changed

+521
-480
lines changed

5 files changed

+521
-480
lines changed

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Original C library created by Pieter Geelen. Work on Java version
22
of the Mapcode library by Rijn Buve and Matthew Lowden.
33

4-
Copyright (C) 2014 Stichting Mapcode Foundation (http://www.mapcode.com)
4+
Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ decode Mapcodes.
4646

4747
## Release Notes
4848

49+
* 1.50
50+
51+
Added 22-chararcter post-processing of all-digit mapcodes for the Greek alphabet.
52+
Retired legacy aliases EAZ and SKM, AU-QL, AU-TS, AU-NI and AU-JB.
53+
Retired legacy Antarctica claims AT0 through AT8.
54+
4955
* 1.41.1
5056

5157
Bugfix for “example/mapcode” utility (-d option was case sensitive).

example/mapcode.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,20 @@ static void selfCheckLatLonToMapcode(const double lat, double lon, const char* t
204204
}
205205
int found = 0;
206206
for (int i = 0; !found && (i < nrResults); ++i) {
207+
208+
/* Check if the territory and code were found in results. Note that the territory
209+
* may be a minimal code, like IN (which may indicate US-IN or RU-IN).
210+
*/
207211
const char* foundMapcode = results[(i * 2)];
208212
const char* foundTerritory = results[(i * 2) + 1];
209-
found = ((strcasecmp(territory, foundTerritory) == 0) && (strcasecmp(mapcode, foundMapcode) == 0));
213+
char* foundTerritoryMin = strstr(foundTerritory, "-");
214+
if (foundTerritoryMin && (strlen(foundTerritoryMin) > 0)) {
215+
++foundTerritoryMin;
216+
}
217+
218+
found = (((strcasecmp(territory, foundTerritory) == 0) ||
219+
(strcasecmp(territory, foundTerritoryMin) == 0)) &&
220+
(strcasecmp(mapcode, foundMapcode) == 0));
210221
}
211222
if (!found) {
212223
fprintf(stderr, "error: encoding lat/lon to mapcode failure; "

mapcodelib/basics.h

Lines changed: 10 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@
1616

1717
#define UWORD unsigned short int // 2-byte unsigned integer
1818

19-
#define mapcode_cversion "1.41"
19+
#define mapcode_cversion "1.50"
2020
#define MAXWIDE 10
2121
#define BASEX 31
2222
#define MAXFITLONG 6
2323
#define XSIDE3 168
2424
#define YSIDE3 176
2525

26-
#define ALIASES "2UK=2UT,2CG=2CT,1GU=GUM,1UM=UMI,1VI=VIR,1PR=PRI,1AS=ASM,1MP=MNP,4JB=JBT,4QL=QLD,4TS=TAS,4CX=CXR,4CC=CCK,4NF=NFK,4HM=HMD,4NI=NFK,COL=5CL,5ME=5MX,MEX=5MX,5TM=TAM,5AG=AGU,5BC=BCN,5BS=BCS,5CM=CAM,5CS=CHP,5CH=CHH,5CO=COA,5DF=DIF,5DG=DUR,5GT=GUA,5GR=GRO,5HG=HID,5JA=JAL,5MI=MIC,5MO=MOR,5NA=NAY,5NL=NLE,5OA=OAX,5PB=PUE,5QE=QUE,5QR=ROO,5SL=SLP,5SI=SIN,5SO=SON,5TB=TAB,5TL=TLA,5VE=VER,5YU=YUC,5ZA=ZAC,811=8BJ,812=8TJ,813=8HE,814=8SX,815=8NM,821=8LN,822=8JL,823=8HL,831=8SH,832=8JS,833=8ZJ,834=8AH,835=8FJ,836=8JX,837=8SD,841=8HA,842=8HB,843=8HN,844=8GD,845=8GX,846=8HI,850=8CQ,851=8SC,852=8GZ,853=8YN,854=8XZ,861=8SN,862=8GS,863=8QH,864=8NX,865=8XJ,871=TWN,891=HKG,892=MAC,8TW=TWN,8HK=HKG,8MC=MAC,BEL=7BE,KIR=7KI,PRI=7PO,CHE=7CH,KHM=7KM,PER=7PM,TAM=7TT,0US=USA,0AU=AUS,0RU=RUS,0CN=CHN,EAZ=TZA,SKM=2SK,TAA=SHN,ASC=SHN,DGA=IOT,WAK=MHL,JTN=UMI,MID=1HI,2OD=2OR,"
26+
#define ALIASES "2UK=2UT,2CG=2CT,1GU=GUM,1UM=UMI,1VI=VIR,1PR=PRI,1AS=ASM,1MP=MNP,4CX=CXR,4CC=CCK,4NF=NFK,4HM=HMD,COL=5CL,5ME=5MX,MEX=5MX,5TM=TAM,5AG=AGU,5BC=BCN,5BS=BCS,5CM=CAM,5CS=CHP,5CH=CHH,5CO=COA,5DF=DIF,5DG=DUR,5GT=GUA,5GR=GRO,5HG=HID,5JA=JAL,5MI=MIC,5MO=MOR,5NA=NAY,5NL=NLE,5OA=OAX,5PB=PUE,5QE=QUE,5QR=ROO,5SL=SLP,5SI=SIN,5SO=SON,5TB=TAB,5TL=TLA,5VE=VER,5YU=YUC,5ZA=ZAC,811=8BJ,812=8TJ,813=8HE,814=8SX,815=8NM,821=8LN,822=8JL,823=8HL,831=8SH,832=8JS,833=8ZJ,834=8AH,835=8FJ,836=8JX,837=8SD,841=8HA,842=8HB,843=8HN,844=8GD,845=8GX,846=8HI,850=8CQ,851=8SC,852=8GZ,853=8YN,854=8XZ,861=8SN,862=8GS,863=8QH,864=8NX,865=8XJ,871=TWN,891=HKG,892=MAC,8TW=TWN,8HK=HKG,8MC=MAC,BEL=7BE,KIR=7KI,PRI=7PO,CHE=7CH,KHM=7KM,PER=7PM,TAM=7TT,0US=USA,0AU=AUS,0RU=RUS,0CN=CHN,TAA=SHN,ASC=SHN,DGA=IOT,WAK=MHL,JTN=UMI,MID=1HI,2OD=2OR,"
2727

28-
#define MAX_CCODE 542 // total number of areas (i.e. recognised iso codes) in this database
28+
#define MAX_CCODE 533 // total number of areas (i.e. recognised iso codes) in this database
2929
static const char *entity_iso = ""
3030
"VAT,MCO,GIB,TKL,CCK,BLM,NRU,TUV,MAC,SXM,"
3131
"MAF,NFK,PCN,BVT,BMU,IOT,SMR,GGY,AIA,MSR,"
@@ -80,8 +80,7 @@ static const char *entity_iso = ""
8080
"8HI,8NX,8CQ,8ZJ,8JS,8FJ,8AH,8LN,8SD,8SX,"
8181
"8JX,8HA,8GZ,8GD,8HB,8JL,8HE,8SN,8NM,8HL,"
8282
"8HN,8GX,8SC,8YN,8XZ,8GS,8QH,8XJ,CHN,UMI,"
83-
"CPT,AT0,AT1,AT2,AT3,AT4,AT5,AT6,AT7,AT8,"
84-
"ATA,AAA,";
83+
"CPT,ATA,AAA,";
8584

8685
#define usa_from 343
8786
#define usa_upto 393
@@ -107,8 +106,8 @@ static const char *entity_iso = ""
107106
#define rus_from 412
108107
#define rus_upto 494
109108
#define ccode_rus 496
110-
#define ccode_ata 540
111-
#define ccode_earth 541
109+
#define ccode_ata 531
110+
#define ccode_earth 532
112111

113112
#define parents3 "USA,IND,CAN,AUS,MEX,BRA,RUS,CHN,"
114113
#define parents2 "US,IN,CA,AU,MX,BR,RU,CN,"
@@ -161,11 +160,11 @@ static const signed char decode_chars[256] = {
161160
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
162161
};
163162

164-
static const char encode_chars[31] = {
163+
static const char encode_chars[34] = {
165164
'0','1','2','3','4','5','6','7','8','9',
166165
'B','C','D','F','G','H','J','K','L','M',
167166
'N','P','Q','R','S','T','V','W','X','Y','Z'
168-
};
167+
,'A','E','U'};
169168

170169

171170
static const UWORD data_start[MAX_CCODE+1] = {
@@ -222,11 +221,10 @@ static const UWORD data_start[MAX_CCODE+1] = {
222221
15477,15493,15530,15547,15571,15594,15611,15631,15657,15683,
223222
15702,15719,15772,15813,15835,15862,15882,15903,15921,15951,
224223
15977,15997,16018,16036,16054,16073,16089,16105,16133,16159,
225-
16166,16168,16169,16171,16172,16174,16176,16178,16180,16182,
226-
16183,16184,16216
224+
16166,16168,16169,16201
227225
};
228226

229-
#define NR_RECS 16216
227+
#define NR_RECS 16201
230228
#define WORST_RECS_PER_CCODE 195 // 8 Argentina @43
231229

232230
typedef struct { long minx; long miny; long maxx; long maxy; unsigned long flags; } mminforec;
@@ -16401,21 +16399,6 @@ static const mminforec mminfo[NR_RECS+1] = {
1640116399
{-177600000, -600000,-159800000, 18000000,0x0010637},
1640216400
{-109259020, 10252083,-109171569, 10338573,0x001002b},
1640316401
{-109450135, 10049808,-108976207, 10540848,0x001002c},
16404-
{ 158461004, -54885191, 159257828, -54394151,0x001002c},
16405-
{-180000000, -90000000, 180000000, -60000000,0x1860037},
16406-
{ 160000000, -90000000, 210000000, -60000000,0x003023c},
16407-
{ 136183350, -90000000, 142033333, -60000000,0xbb40036},
16408-
{-180000000, -90000000, 180000000, -60000000,0x1860037},
16409-
{ 44633300, -90000000, 160000000, -60000000,0x003023c},
16410-
{-180000000, -90000000, 180000000, -60000000,0x1860037},
16411-
{ -20000000, -90000000, 44633300, -60000000,0x003023c},
16412-
{-180000000, -90000000, 180000000, -60000000,0x1860037},
16413-
{ -80000000, -90000000, -20000000, -60000000,0x003023c},
16414-
{-180000000, -90000000, 180000000, -60000000,0x1860037},
16415-
{ -90000000, -90000000, -53000000, -60000000,0x003023c},
16416-
{-180000000, -90000000, 180000000, -60000000,0x1860037},
16417-
{ -74000000, -90000000, -25000000, -60000000,0x003023c},
16418-
{ -91104216, -69041108, -90099072, -68648276,0x001002c},
1641916402
{-180000000, -90000000, 180000000, -60000000,0x1860037},
1642016403
{-180000000, -90000000, 180000000, -77183669,0x0010497},
1642116404
{-180000000, -77183669, 180000000, -66998607,0x1000c97},

0 commit comments

Comments
 (0)