Skip to content

Commit

Permalink
Merge pull request #3 from mapcode-foundation/dev-1.50
Browse files Browse the repository at this point in the history
Move from dev-1.50 to master
  • Loading branch information
rijnb committed May 22, 2015
2 parents 9a62279 + c93d215 commit 9666cbf
Show file tree
Hide file tree
Showing 6 changed files with 595 additions and 543 deletions.
4 changes: 2 additions & 2 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Original C library created by Pieter Geelen. Work on Java version
of the Mapcode library by Rijn Buve and Matthew Lowden.
of the Mapcode library by Rijn Buve (original port by Matthew Lowden).

Copyright (C) 2014 Stichting Mapcode Foundation (http://www.mapcode.com)
Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,32 @@ Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)

The directory 'mapcodelib' contains the files:

mapcoder.h <-- Header file with method prototypes and defines for caller.
mapcoder.c
basics.h
mapcoder.h <-- Header file with method prototypes and defines for caller.
mapcoder.c
basics.h

Together these provide routine to encode/decode Mapcodes.

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

mapcode_library.doc (Microsoft Word format).
mapcode_library.doc (Microsoft Word format).

Also see www.mapcode.com for background and reference materials.

Note: this version may be restricted to a particular area of the Earth!
In that case, basics.h will state a version number of the for:
#define mapcode_cversion "1.2xxx"
#define mapcode_cversion "1.2xxx"
where "xxx" states the geographical limitation.


## A Real-Life Example, The 'mapcode' Codec Tool: `example/`
## A Real-Life Example, The 'mapcode' Codec Tool: `utility/`

The directory 'example' contains a Mapcode encoding/decoding utility, as an example
The directory 'utility' contains a Mapcode encoding/decoding utility, as an example
of how to use the library.

To build the original Mapcode tool, execute:

cd example
cd utility
gcc mapcode.cpp -o mapcode

For help, simply execute the binary file 'mapcode' without no arguments.
Expand All @@ -46,19 +46,30 @@ decode Mapcodes.

## Release Notes

* 1.50

Major release. This version is not backwards compatible with mapcode 1.4x: is has dropped support for
Antartica AT0-8 codes and has a changed (improved) way of dealing with the Greek alphabet.

Added 22-chararcter post-processing of all-digit mapcodes for the Greek alphabet.

Retired legacy aliases EAZ and SKM, AU-QL, AU-TS, AU-NI and AU-JB.

Retired legacy Antarctica claims AT0 through AT8.

* 1.41.1

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

* 1.41

Added the India state Telangana (IN-TG), until 2014 a region in Adhra Pradesh.

Fixed a problem with the "extraDigits" parameter of the “example/mapcode" utility (maximum digits is 2, not 3).
Fixed a problem with the "extraDigits" parameter of the “utility/mapcode" utility (maximum digits is 2, not 3).

* 1.40

Added extraDigits parameter to allow high-precision mapcodes to be generated by the “example/mapcode” utility.
Added extraDigits parameter to allow high-precision mapcodes to be generated by the “utility/mapcode” utility.

* 1.33

Expand Down
39 changes: 11 additions & 28 deletions mapcodelib/basics.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2014 Stichting Mapcode Foundation (http://www.mapcode.com)
* Copyright (C) 2014-2015 Stichting Mapcode Foundation (http://www.mapcode.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,16 +16,16 @@

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

#define mapcode_cversion "1.41"
#define mapcode_cversion "1.50"
#define MAXWIDE 10
#define BASEX 31
#define MAXFITLONG 6
#define XSIDE3 168
#define YSIDE3 176

#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,"
#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,"

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

#define usa_from 343
#define usa_upto 393
Expand All @@ -107,8 +106,8 @@ static const char *entity_iso = ""
#define rus_from 412
#define rus_upto 494
#define ccode_rus 496
#define ccode_ata 540
#define ccode_earth 541
#define ccode_ata 531
#define ccode_earth 532

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

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


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

#define NR_RECS 16216
#define NR_RECS 16201
#define WORST_RECS_PER_CCODE 195 // 8 Argentina @43

typedef struct { long minx; long miny; long maxx; long maxy; unsigned long flags; } mminforec;
Expand Down Expand Up @@ -16401,21 +16399,6 @@ static const mminforec mminfo[NR_RECS+1] = {
{-177600000, -600000,-159800000, 18000000,0x0010637},
{-109259020, 10252083,-109171569, 10338573,0x001002b},
{-109450135, 10049808,-108976207, 10540848,0x001002c},
{ 158461004, -54885191, 159257828, -54394151,0x001002c},
{-180000000, -90000000, 180000000, -60000000,0x1860037},
{ 160000000, -90000000, 210000000, -60000000,0x003023c},
{ 136183350, -90000000, 142033333, -60000000,0xbb40036},
{-180000000, -90000000, 180000000, -60000000,0x1860037},
{ 44633300, -90000000, 160000000, -60000000,0x003023c},
{-180000000, -90000000, 180000000, -60000000,0x1860037},
{ -20000000, -90000000, 44633300, -60000000,0x003023c},
{-180000000, -90000000, 180000000, -60000000,0x1860037},
{ -80000000, -90000000, -20000000, -60000000,0x003023c},
{-180000000, -90000000, 180000000, -60000000,0x1860037},
{ -90000000, -90000000, -53000000, -60000000,0x003023c},
{-180000000, -90000000, 180000000, -60000000,0x1860037},
{ -74000000, -90000000, -25000000, -60000000,0x003023c},
{ -91104216, -69041108, -90099072, -68648276,0x001002c},
{-180000000, -90000000, 180000000, -60000000,0x1860037},
{-180000000, -90000000, 180000000, -77183669,0x0010497},
{-180000000, -77183669, 180000000, -66998607,0x1000c97},
Expand Down
Loading

0 comments on commit 9666cbf

Please sign in to comment.