├── .gitignore ├── LICENSE ├── NOTICE ├── README.md ├── ctrynams.js ├── ctrynams_short.js ├── examples ├── FileSaver.js ├── converter.html ├── jquery.csv.js └── sample.csv ├── mapcode.js ├── mapcode_library_js.doc ├── ndata.js ├── sample.html └── unittest ├── test_encodes.js ├── test_territories.js └── unittest.html /.gitignore: -------------------------------------------------------------------------------- 1 | # ----------------------------------------------------------------------------- 2 | # Compiled sources 3 | # ----------------------------------------------------------------------------- 4 | *.com 5 | *.class 6 | *.dll 7 | *.exe 8 | *.o 9 | *.so 10 | 11 | # ----------------------------------------------------------------------------- 12 | # Packages and archives 13 | # ----------------------------------------------------------------------------- 14 | # It's better to unpack these files and commit the raw source 15 | # git has its own built in compression methods. 16 | # *.7z 17 | # *.dmg 18 | # *.gz 19 | # *.iso 20 | # *.jar 21 | # *.rar 22 | # *.tar 23 | # *.zip 24 | 25 | # ----------------------------------------------------------------------------- 26 | # Logs and databases 27 | # ----------------------------------------------------------------------------- 28 | *.log 29 | # *.sql - we need to commit raw SQL for test database creation 30 | *.sqlite 31 | *.tlog 32 | *.epoch 33 | *.swp 34 | *.hprof 35 | *.hprof.index 36 | *~ 37 | 38 | # ----------------------------------------------------------------------------- 39 | # OS generated files 40 | # ----------------------------------------------------------------------------- 41 | .DS_Store* 42 | ehthumbs.db 43 | Icon? 44 | Thumbs.db 45 | 46 | # ----------------------------------------------------------------------------- 47 | # Maven generated files 48 | # ----------------------------------------------------------------------------- 49 | target/ 50 | */target/ 51 | out/ 52 | 53 | # ----------------------------------------------------------------------------- 54 | # IntelliJ IDEA 55 | # ----------------------------------------------------------------------------- 56 | # Not safe to share any of this across different IDEA major versions. Use the POMs. 57 | *.iml 58 | *.iws 59 | *.releaseBackup 60 | 61 | .idea 62 | .idea/.name 63 | .idea/artifacts/ 64 | .idea/workspace.xml 65 | .idea/dataSources.xml 66 | .idea/sqlDataSources.xml 67 | .idea/dynamic.xml 68 | .idea/compiler.xml 69 | .idea/misc.xml 70 | .idea/tasks.xml 71 | .idea/uiDesigner.xml 72 | .idea/libraries/* 73 | .idea/dictionaries/* 74 | .idea/modules.xml 75 | .idea/scopes/* 76 | 77 | # .idea/inspectionProfiles/* 78 | 79 | atlassian-ide-plugin.xml 80 | 81 | # ----------------------------------------------------------------------------- 82 | # Eclipse files 83 | # ----------------------------------------------------------------------------- 84 | .classpath 85 | .project 86 | .settings 87 | .cache 88 | 89 | # ----------------------------------------------------------------------------- 90 | # Netbeans files 91 | # ----------------------------------------------------------------------------- 92 | nb-configuration.xml 93 | *.orig 94 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | Copyright 2018, Stichting Mapcode Foundation 180 | 181 | Licensed under the Apache License, Version 2.0 (the "License"); 182 | you may not use this file except in compliance with the License. 183 | You may obtain a copy of the License at 184 | 185 | http://www.apache.org/licenses/LICENSE-2.0 186 | 187 | Unless required by applicable law or agreed to in writing, software 188 | distributed under the License is distributed on an "AS IS" BASIS, 189 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 190 | See the License for the specific language governing permissions and 191 | limitations under the License. 192 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | MAPCODE JAVASCRIPT LIBRARY 3 | ------------------------------------------------------------------------------- 4 | 5 | Original C library created by Pieter Geelen. Work on Java version 6 | of the Mapcode library by Rijn Buve (original port by Matthew Lowden). 7 | 8 | Copyright (C) 2003-2018 Stichting Mapcode Foundation (http://www.mapcode.com) 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Mapcode Library for JavaScript 2 | 3 | [![Codacy Badge](https://api.codacy.com/project/badge/Grade/c86dbf5e7deb493db7ac1a3483dfddfb)](https://www.codacy.com/app/rijnb/mapcode-js?utm_source=github.com&utm_medium=referral&utm_content=mapcode-foundation/mapcode-js&utm_campaign=Badge_Grade) 4 | [![License](http://img.shields.io/badge/license-APACHE2-blue.svg)]() 5 | [![Release](https://img.shields.io/github/release/mapcode-foundation/mapcode-js.svg?maxAge=3600)](https://github.com/mapcode-foundation/mapcode-js/releases) 6 | 7 | 8 | **Copyright (C) 2003-2018 Stichting Mapcode Foundation (http://www.mapcode.com)** 9 | 10 | ---- 11 | 12 | **Online documentation can be found at: http://mapcode-foundation.github.io/mapcode-js/** 13 | 14 | If you plan to use mapcodes in HTML/Javascript extensively, you may be interested in 15 | looking at running an instance of a Mapcode REST API server in your applications 16 | landscape. 17 | 18 | This reduces the payload the HTML/Javascript tremendously, as the mapcode tables will 19 | not need to be transported to the client. 20 | 21 | You can find the Mapcode REST API sources, ready to be deployed on any JVM server, 22 | like Tomcat or Jetty, on: **https://github.com/mapcode-foundation/mapcode-rest-service** 23 | 24 | # License 25 | 26 | Licensed under the Apache License, Version 2.0 (the "License"); 27 | you may not use this file except in compliance with the License. 28 | You may obtain a copy of the License at 29 | 30 | http://www.apache.org/licenses/LICENSE-2.0 31 | 32 | Unless required by applicable law or agreed to in writing, software 33 | distributed under the License is distributed on an "AS IS" BASIS, 34 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 35 | See the License for the specific language governing permissions and 36 | limitations under the License. 37 | 38 | Original C library created by Pieter Geelen. Work on Java version 39 | of the Mapcode library by Rijn Buve and Matthew Lowden. 40 | 41 | # Javascript Files for Mapcode Support 42 | 43 | The following files provide the Javascript interfaces for mapcodes: 44 | 45 | mapcode.js - Key routines for mapcode support 46 | ndata.js - Data table for mapcode support 47 | 48 | sample.html - Sample code to interpret / generate mapcodes 49 | ctrynams.js - Optional js array with the names of territories (in English) 50 | 51 | To run the Javascript unit tests, simply open the file `unittest/unittest/html`. 52 | 53 | # Using the Library 54 | 55 | ## Converting a Coordinate into a Mapcode 56 | 57 | In the mapcode system, territories are limited by rectangles, not by actual or political borders. 58 | This means that a coordinate will often yield mapcode possibilities in more than one territory. 59 | Each possibility correctly represents the coordinate, but which one is *politically* correct is a 60 | choice that must be made (in advance or afterwards) by the caller or user of the routines. 61 | 62 | There are several routines to generate the possible mapcodes for a coordinate. 63 | The right one to use depends on the situation. All routines take a latitude and a longitude, 64 | and all routines yield an array of possible mapcodes, with the following structure: 65 | 66 | attribute | description 67 | --- | --- 68 | fullmapcode | string, full mapcode including full territory alphacode 69 | mapcode | string, full mapcode excluding territory alphacode 70 | territoryAlphaCode | string, full territory alphacode 71 | 72 | ### The Shortest Mapcode 73 | 74 | The most widely used routine to generate mapcodes is probably: 75 | 76 | encodeShortest(lat, lon, territory) 77 | 78 | parameter | description 79 | --- | --- 80 | lat | latitude in degrees (maximized by routine to 90.0 and minimized to -90.0) 81 | lon | longitude in degrees (all values allowed, wrapped to -180.0 and +180.0) 82 | territory | a territory (an iso code such as “NLD”) 83 | return value | an array of result records (see above) 84 | 85 | This routine will yield at most one result: the shortest mapcode (if any) that exists 86 | for that coordinate within the specified territory. Such a mapcode is also 87 | sometimes called the “default mapcode” for a particular territory. 88 | 89 | Example Javascript: 90 | 91 | function displayMapcodes(e) { 92 | document.write('',e.length,' result(s)
'); 93 | for(var i = 0; i < e.length; i++) { 94 | if (e[i].territoryAlphaCode != "AAA") { 95 | document.write(e[i].territoryAlphaCode, ' '); 96 | } 97 | document.write('', e[i].mapcode, '
'); 98 | } 99 | } 100 | displayMapcodes(encodeShortest(34.00956, -118.210572, 'US-CA')); 101 | 102 | Output: 103 | 104 | 1 result(s): 105 | US-CA XX.XX 106 | 107 | To get a mapcode for every territory in which a coordinate can be encoded, use 108 | 109 | encodeShortest(lat, lon) 110 | 111 | Since any coordinate is somewhere on the world, this routine is guaranteed to deliver at least one possibility. 112 | 113 | Example Javascript: 114 | 115 | var e = encodeShortest(34.00956, -118.210572); 116 | 117 | Output using displayMapcodes(e): 118 | 119 | 3 result(s) 120 | US-CA XX.XX 121 | USA KKYP.19MN 122 | R59KJ.W5FT 123 | 124 | This particular coordinate thus has a California mapcode (`XX.XX`), a national 8-letter mapcode, 125 | and (like any coordinate) an international 9-letter mapcode (by tradition shown without its 126 | alphacode “`AAA`”). 127 | 128 | ### All Possible Mapcodes 129 | 130 | Even within a particular territory, there are often several possible mapcodes. 131 | 132 | encode(lat,lon, territory) 133 | 134 | will yield all possible mapcodes (if any) within the specified territory, while 135 | 136 | encode(lat, lon) 137 | 138 | will simply yield all mapcodes that can represent the coordinate. 139 | 140 | Example Javascript: 141 | 142 | var e = encode(36.115, -115.1731, 'US-NV'); 143 | 144 | Output using `displayMapcodes(e)`: 145 | 146 | 5 result(s) 147 | US-NV CN.NN 148 | US-NV BX.5KF 149 | US-NV NJ7.127 150 | US-NV F978.JY1 151 | US-NV L70X.6V4G 152 | 153 | The results are ordered by length, the first is the shortest (the default). 154 | The last is usually the “national” encoding, i.e. a format that all coordinates within a 155 | country share. Of course, the shortest mapcode is preferred in almost every circumstance. 156 | 157 | Example Javascript: 158 | 159 | var e = encode(36.115, -115.1731); 160 | 161 | Output using `displayMapcodes(e)`: 162 | 163 | 9 result(s) 164 | US-NV CN.NN 165 | US-NV BX.5KF 166 | US-NV NJ7.127 167 | US-NV F978.JY1 168 | US-NV L70X.6V4G 169 | US-CA F978.JY1 170 | US-CA L70X.6V4G 171 | USA L70X.6V4G 172 | R5KDM.C8C8 173 | 174 | Note that two of these (in `US-CA`) are politically incorrect, since the specified coordinate 175 | lies within the borders of Nevada and not California. However, they are valid in that the 176 | mapcodes correctly represent the original coordinate. 177 | 178 | ### International Mapcodes 179 | 180 | For very specific applications, the following routine only returns the international mapcode 181 | 182 | encodeInternational(lat, lon) 183 | 184 | returns an array with exactly one result: the 9-letter international mapcode representing 185 | the coordinate. 186 | 187 | ### Higher Precision Mapcodes 188 | 189 | A mapcode represents a coordinate with a precision of a few meters. To be precise, 190 | most mapcodes represent the center point of a 10x10 meter area. The coordinate may 191 | thus be 5 meters off both longitudinally and latitudinal, or 3.6 meters on average. 192 | This is precise enough for everyday use, but mapcodes can also be generate with higher 193 | precisions. With one extra letter (after a hyphen), a mapcode represents a 2x2 meter area, 194 | with two letters, an area of a square foot. The extra letters defeat the purpose of the 195 | mapcode system (which is to offer short, easy codes for everyday use) but there may be 196 | cases where the extra letters are appropriate. 197 | 198 | For all routines mentioned, there are “`WithPrecision`” variants: 199 | 200 | encodeShortestWithPrecision(lat, lon, territory, precision) 201 | encodeShortestWithPrecision(lat, lon, precision) 202 | encodeWithPrecision(lat, lon, territory, precision) 203 | encodeWithPrecision(lat, lon, precision) 204 | encodeInternationalWithPrecision(lat, lon, precision) 205 | 206 | where precision is an integer specifying how many extra letters must be generated. 207 | Using the value 0 just yields normal mapcodes. 208 | 209 | ## Converting a Mapcode into a Coordinate 210 | 211 | Given a string with a mapcode (which may or may not include a territory alphacode and may or may not include high-precision letters at the end), the following routines are available to decode them back to a coordinate: 212 | 213 | decode(mapcodeString) 214 | 215 | parameter | description | 216 | --- | --- 217 | mapcodeString | a string containing a mapcode 218 | return value | an object with fields `x` (longitude) and `y` (latitude), or false 219 | 220 | This routine is sufficient to decode a full mapcodeString into a coordinate. 221 | 222 | Example Javascript: 223 | 224 | var result = decode('NLD 49.4V'); 225 | document.write(result.y + ',' + result.x + '
'); 226 | 227 | Output: 228 | 229 | 52.376514, 4. 908543375 230 | 231 | However, in daily life you will often have to cope with mapcodes provided by people who 232 | abbreviate or completely leave out the alphacode of the territory. For example, the 233 | alphacode `US-AR` may have been abbreviated to `AR`, which within the context of the 234 | United States of America clearly identifies the state of Arkansas, but could in fact 235 | just as well represent Arunachal Pradesh, India. Someone in The Netherlands may even 236 | abbreviate a mapcode to just “`49.4V`”, assuming that the country is obvious. 237 | 238 | The following routine provides an argument to “help” decoding such input: 239 | 240 | decode(mapcodeString, contextTerritory) 241 | 242 | parameter | description 243 | --- | --- 244 | mapcodeString | a string containing a mapcode 245 | contextTerritory | a string (an ISO code such as “NLD”) 246 | return value | an object with fields `x` (longitude) and `y` (latitude), or false 247 | 248 | By passing a context territory, you allow the decode routine to solve any ambiguities. 249 | 250 | Example Javascript: 251 | 252 | // Assume the user of the system is Delhi, India 253 | var defaultcontext = 'IN-DL'; 254 | 255 | var result; 256 | result = decode('US-AR 49.4V', defaultcontext); 257 | document.write(result.y + ',' + result.x + '
'); 258 | result = decode('AR 49.4V', defaultcontext); 259 | document.write(result.y + ',' + result.x + '
'); 260 | result = decode('49.4V', defaultcontext); 261 | document.write(result.y + ',' + result.x + '
'); 262 | result = decode('xxx.xxxx', defaultcontext); 263 | document.write(result.y + ',' + result.x + '
'); 264 | 265 | Output: 266 | 267 | 34.77035,-92.3273875 268 | 27.0693605,93.59582 269 | 28.648506,77.183788 270 | 24.423323,92.506517 271 | 272 | Thus, the first, complete mapcode (`US-AR 49.4V`) does not require the provided context, 273 | and simply returns a coordinate in Arkansas. But the second, specifying only `AR`, 274 | is interpreted as `IN-AR` (without the context, it might just as well have been 275 | interpreted as Arkansas, USA). The third and fourth examples specify no territory 276 | whatsoever so could never be interpreted correctly without the aid of the context provided. 277 | The third, `49.4V`, is simply interpreted within the specified context, `IN-DL`, and yields a 278 | New Delhi address. The fourth can not be interpreted in the state of Delhi, but can be 279 | interpreted in India and yields a coordinate in Assam. Note that the input “`49.4V`” 280 | would not have yielded results if the context had been `IND` (since many states in 281 | India have mapcode `49.4V`). 282 | 283 | ## Routines Related to Territories 284 | 285 | getTerritoryFullname(territory) 286 | 287 | parameter | description 288 | --- | --- 289 | territory | an string (an ISO code such as “`NLD`”) 290 | return value | string (the full name of the territory) 291 | 292 | isSubdivision(territory) 293 | 294 | parameter | description 295 | --- | --- 296 | territory | an string (an ISO code such as “`NLD`”) 297 | return value | true iff territory is a subdivision of a country 298 | 299 | hasSubdivisions(territory) 300 | 301 | parameter | description 302 | --- | --- 303 | territory | an string (an ISO code such as “`NLD`”) 304 | return value | true iff territory is a country that has subdivisions 305 | 306 | getTerritoryAlphaCode(territory, format) 307 | 308 | parameter | description 309 | --- | --- 310 | territory | string (or internal integer between 0 and `ccode_earth`) 311 | format | 0: leave out country for subdivisions 312 | . | undefined or 1: always return full abbreviation 313 | . | 2: leave out country for subdivisions unless this would make the abbreviation ambigious 314 | return value | territory abbreviation in the specified format, or empty 315 | 316 | ## Routines Related to Distance 317 | 318 | distanceInMeters(lat1, lon1, lat2, lon2) 319 | 320 | parameter | description 321 | --- | --- 322 | lat1, lon1 | a latitude/longitude (in degrees) 323 | lat2, lon2 | another latitude/longitude (in degrees) 324 | return value | distance between the coordinates, in meters 325 | 326 | **Note:** estimate, only correct for coordinates that are within a few miles of each other. 327 | 328 | maxErrorInMeters(precision) 329 | 330 | parameter | description 331 | --- | --- 332 | precision | the number of “high precision digits” in a mapcode 333 | return value | worst-case distance in meters between the original coordinate and the decode location of the mapcode. 334 | 335 | ## Routines Related to Unicode and Alphabets 336 | 337 | Mapcodes may be specified in other alphabets. These routines takes a mapcode in any 338 | alphabet and returns its equivalent in the target alphabet. Characters that have no 339 | roman equivalent in the mapcode system are replaced by question marks. Territories 340 | (in fact anything before a separating space) are left untouched. 341 | 342 | convertToAlphabet(mapcode, targetAlphabet) 343 | convertToAlphabetAsHTML(mapcode, targetAlphabet) 344 | 345 | parameter | description 346 | --- | --- 347 | mapcode | a string 348 | targetAlphabet | an integer (identifying one of the languages) 349 | return value | a string 350 | 351 | Example Javascript: 352 | 353 | document.write(convertToAlphabetAsHTML(‘PQ.RS’, 4) ,’
’) 354 | document.write(convertToAlphabetAsHTML(‘PQ.RS’, 2) ,’
’) 355 | 356 | Output: 357 | 358 | नप.भम 359 | РФ.ЯЦ 360 | 361 | The following alphabets have been approved for official use, 362 | 363 | 0: roman 364 | 2: cyrillic 365 | 4: hindi 366 | 12: gurmukhi 367 | 368 | Other values are available but have not yet officially been formally approved: 369 | 370 | 1: Greek 371 | 3: Hebrew 372 | 5: Malay 373 | 6: Georgian 374 | 7: Katakana 375 | 8: Thai 376 | 9: Lao 377 | 10: Armenian 378 | 11: Bengali 379 | 13: Tibetan 380 | 381 | Please check http://www.mapcode.com to see if there is a more up-to-date version. 382 | 383 | 384 | # Version History 385 | 386 | ### 2.4.1 - 2.4.2 387 | 388 | * Fixed bug in `getTerritoryAlphaCode` when getting the shortest unambiguous code for `US-CA`, 389 | which is `CA`, not `US-CA`. 390 | 391 | ### 2.4.0 392 | 393 | * Added scripts for Korean (Choson'gul / Hangul), Burmese, Khmer, Sinhalese, Thaana (Maldivan), 394 | Chinese (Zhuyin, Bopomofo), Tifinagh (Berber), Tamil, Amharic, Telugu, Odia, Kannada, Gujarati. 395 | 396 | * Renamed language strings to more correct terms (Malay to Malayalam; Hindi to Devanagari). 397 | 398 | * Added var `alphabetsForTerritory[t]`, returning the most commonly used alphabets for territory `t`. 399 | 400 | * Improved some characters for Arabic and Devanagari. 401 | * 402 | Fixed Bengali to also support Assamese. 403 | 404 | * For some alphabets, removed recognition of letters `I` and/or `O` unless looking like digits `1` and/or `0`. 405 | 406 | * Replaced internal encoded `entity_iso[]` array by non-encoded `iso3166alpha[]`. 407 | 408 | ### 2.3.1 409 | 410 | * Minor fixes to prevent some compiler warnings, or multiple inclusion of `.h` files. 411 | 412 | * Minor data fix (`ndata.js`) for Gansu Province, China (where mountain range extending further west). 413 | 414 | ### 2.3.0 415 | 416 | * Arabic script added. 417 | * Tibetan script changed so all characters can be typed on a computer keyboard without using the SHIFT key. 418 | 419 | * Greek, Hebrew and Arabic, the scripts that have (implied) vowels in mapcode sequences, have been extended with 420 | ABJAD conversion, to prevent more than two consecutive non-digits from occurring. 421 | 422 | * NOTE: as a result, mapcodes in Greek, Arab and Hebrew scripts are now often one character longer than in the roman script. 423 | 424 | ### 2.2.0 425 | 426 | * Solved 1-microdegree gap in a few spots on Earth, noticable now extreme precision is possible; 427 | 428 | * Ran source through code prettifier 429 | 430 | ### 2.1.5 431 | 432 | * Added maxErrorInMeters to API; 433 | 434 | * Enforce `encode(decode(m)) == m` except near territory borders 435 | 436 | * Stricter unit tests; 437 | 438 | ### 2.1.1 439 | 440 | * Added DistanceInMeters to API 441 | 442 | ### 2.1.0 443 | 444 | * Rewrote fraction floating points to integer arithmetic 445 | 446 | ### 2.0.3 447 | 448 | * Minor fix. Added `unittest\unittest.html` - open to peform 449 | tests that try to verify that the library works as intended; 450 | 451 | ### 2.0.1 452 | 453 | * Minor fixes. 454 | 455 | ### 2.0.0 - July 2015 456 | 457 | * Fixes to the data rectangles (primarily intended for ISO proposal), see Word document for details. 458 | 459 | ### 1.54 - June 2015 460 | 461 | * Removed unneeded mminfo flags (no effect on functionality). 462 | 463 | ### 1.50.3 - May 2015 464 | 465 | * Redesign of the API to conform to Javascript standards and match the Java implementation of the mapcode system 466 | 467 | ### 1.50.1 - May 2015 468 | 469 | * Bugfix for mapcodes in IN-DD (in India). 470 | 471 | ### 1.50 - May 2015 472 | 473 | * Major release. This version is not backwards compatible with mapcode 1.4x: it has dropped support for 474 | Antartica AT0-8 codes and has a changed (improved) way of dealing with the Greek alphabet. 475 | 476 | * Added 22-chararcter post-processing of all-digit mapcodes for the Greek alphabet. 477 | 478 | * Retired legacy aliases EAZ and SKM, AU-QL, AU-TS, AU-NI and AU-JB. 479 | 480 | * Retired legacy Antarctica claims AT0 through AT8. 481 | 482 | ### 1.41 - January 2015 483 | 484 | * Added the India state Telangana (IN-TG), until 2014 a region in Adhra Pradesh. 485 | 486 | ### 1.33 - August 2014 487 | 488 | * Normalise results when longitude below -180 degrees. 489 | 490 | ### 1.32 - August 2014 491 | 492 | * Prevent FIJI failing to decode at exactly 180 degrees. 493 | 494 | * Prevent invalid filtering near the territory bounding rectangle. 495 | 496 | ### 1.31 - April 2014 497 | 498 | * Make `iso2ccode()` even more forgiving by allowing a state alias to be recognized in context. 499 | 500 | ### 1.3 - April 2014 501 | 502 | * Disable 7-char state codes for large states in India, and instead generate country mapcodes for states. 503 | 504 | ### 1.28 - April 2014 505 | 506 | * Fix for starpipe "zoning" error, causing the last 2 mapcode characters to be ignored in certain areas. 507 | 508 | ### 1.27 - April 2014 509 | 510 | * Support undefined ranges in data array (useful for partial JavaScript builds). 511 | 512 | ### 1.26 - May 2013 513 | 514 | * Added alias OD for India, and 2.3 code for Daman and Diu. 515 | 516 | ### 1.25 - May 2013 517 | 518 | * `Ccode2iso(c, 2)` support added. 519 | 520 | ### 1.24 - May 2013 521 | 522 | * Public domain release. 523 | 524 | -------------------------------------------------------------------------------- /ctrynams.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2018 Stichting Mapcode Foundation (http://www.mapcode.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // *** GENERATED FILE (coords.cpp), DO NOT CHANGE OR PRETTIFY *** 18 | 19 | var isofullname = [ 20 | "Vatican (Holy See) (_ City State)", 21 | "Monaco (Principality of _)", 22 | "Gibraltar", 23 | "Tokelau", 24 | "Cocos Islands (Keeling Islands)", 25 | "Saint-Barthelemy (Collectivity of _)", 26 | "Nauru (Republic of _)", 27 | "Tuvalu", 28 | "Macau (Aomen)", 29 | "Sint Maarten", 30 | "Saint Martin (Collectivity of _)", 31 | "Norfolk and Philip Island (Philip Island) (Norfolk Island)", 32 | "Pitcairn Islands (Pitcairn, Henderson, Ducie and Oeno Islands)", 33 | "Bouvet Island", 34 | "Bermuda (Somers Isles)", 35 | "British Indian Ocean Territory", 36 | "San Marino (Republic of _)", 37 | "Guernsey (Bailiwick of _)", 38 | "Anguilla", 39 | "Montserrat", 40 | "Jersey (Bailiwick of _)", 41 | "Christmas Island", 42 | "Wallis and Futuna (Futuna) (Wallis) (Collectivity of the _ Islands)", 43 | "British Virgin Islands (Virgin Islands, British)", 44 | "Liechtenstein (Principality of _)", 45 | "Aruba", 46 | "Marshall Islands (Republic of the _)", 47 | "American Samoa (Samoa, American)", 48 | "Cook Islands", 49 | "Saint Pierre and Miquelon (Miquelon) (Saint Pierre) (Collectivity of _)", 50 | "Niue", 51 | "Saint Kitts and Nevis (Nevis) (Saint Kitts) (Federation of _)", 52 | "Cayman islands", 53 | "Bonaire, St Eustasuis and Saba (Bonaire) (Saba) (St Eustasius)", 54 | "Maldives (Republic of _)", 55 | "Saint Helena, Ascension and Tristan da Cunha (Saint Helena) (Ascension) (Tristan da Cunha)", 56 | "Malta (Republic of _)", 57 | "Grenada", 58 | "Virgin Islands of the United States (US Virgin Islands) (American Virgin Islands)", 59 | "Mayotte (Maore)", 60 | "Svalbard and Jan Mayen (Svalbard) (Jan Mayen) (Spitsbergen)", 61 | "Saint Vincent and the Grenadines (Saint Vincent) (Grenadines)", 62 | "Heard Island and McDonald Islands (Heard Island) (McDonald Islands)", 63 | "Barbados", 64 | "Antigua and Barbuda (Antigua) (Barbuda)", 65 | "Curacao", 66 | "Seychelles (Republic of _)", 67 | "Palau (Republic of _)", 68 | "Northern Mariana Islands (Commonwealth of the _)", 69 | "Andorra (Principality of _) (Principality of the Valleys of _)", 70 | "Guam", 71 | "Isle of Mann (Mann)", 72 | "Saint Lucia", 73 | "Micronesia (Federated States of Micronesia)", 74 | "Singapore (Republic of _)", 75 | "Tonga (Kingdom of _)", 76 | "Dominica (Commonwealth of _)", 77 | "Bahrain (Kingdom of _)", 78 | "Kiribati (Republic of _)", 79 | "Turks and Caicos Islands (Turks Islands) (Caicos Islands)", 80 | "Sao Tome and Principe (Sao Tome) (Principe) (Democratic Republic of _)", 81 | "Hong Kong (Xianggang)", 82 | "Martinique", 83 | "Faroe Islands", 84 | "Guadeloupe", 85 | "Comoros (Union of the _)", 86 | "Mauritius (Republic of _)", 87 | "Reunion", 88 | "Luxembourg (Grand Duchy of _)", 89 | "Samoa (Independent State of _)", 90 | "South Georgia and the South Sandwich Islands (South Georgia) (South Sandwich Islands)", 91 | "French Polynesia (Collectivity of _)", 92 | "Cape Verde (Cabo Verde) (Republic of Cabo Verde)", 93 | "Trinidad and Tobago (Republic of _) (Trinidad) (Tobago)", 94 | "Brunei (Nation of _, the Abode of Peace)", 95 | "French Southern and Antarctic Lands", 96 | "Puerto Rico (Commonwealth of _)", 97 | "Cyprus (Republic of _)", 98 | "Lebanon (Lebanese Republic)", 99 | "Jamaica", 100 | "Gambia (The Gambia) (Republic of the _)", 101 | "Qatar (State of _)", 102 | "Falkland Islands (The Falklands)", 103 | "Vanuatu (Republic of _)", 104 | "Montenegro", 105 | "Bahamas (Commonwealth of the _)", 106 | "Timor-Leste (Democratic Republic of _) (East Timor)", 107 | "Swaziland (Kingdom of _)", 108 | "Kuwait (State of _)", 109 | "Fiji (Republic of _)", 110 | "New Caledonia", 111 | "Slovenia (Republic of _)", 112 | "Israel (State of _)", 113 | "Palestinian territories (State of Palestine)", 114 | "El Salvador (Republic of _)", 115 | "Belize", 116 | "Djibouti (Republic of _)", 117 | "Macedonia (Republic of _) (FYROM) (Former Yugoslav Republic of Macedonia)", 118 | "Rwanda (Republic of _)", 119 | "Haiti (Republic of _)", 120 | "Burundi (Republic of _)", 121 | "Equatorial Guinea (Republic of _)", 122 | "Albania (Republic of _)", 123 | "Solomon Islands", 124 | "Armenia (Republic of _)", 125 | "Lesotho (Kingdom of _)", 126 | "Belgium (Kingdom of _)", 127 | "Moldova (Republic of _)", 128 | "Guinea-Bissau (Republic of _)", 129 | "Taiwan (Republic of China)", 130 | "Bhutan (Kingdom of _)", 131 | "Switzerland (Swiss Confederation)", 132 | "Netherlands (The Netherlands) (Kingdom of the _)", 133 | "Denmark (Kingdom of _)", 134 | "Estonia (Republic of _)", 135 | "Dominican Republic", 136 | "Slovakia (Slovak Republic)", 137 | "Costa Rica (Republic of _)", 138 | "Bosnia and Herzegovina", 139 | "Croatia (Republic of _)", 140 | "Togo (Togolese Republic)", 141 | "Latvia (Republic of _)", 142 | "Lithuania (Republic of _)", 143 | "Sri Lanka (Democratic Socialist Republic of _)", 144 | "Georgia", 145 | "Ireland (Republic of _)", 146 | "Sierra Leone (Republic of _)", 147 | "Panama (Republic of _)", 148 | "Czech Republic", 149 | "French Guiana (Guiana)", 150 | "United Arab Emirates (Emirates)", 151 | "Austria (Republic of _)", 152 | "Azerbaijan (Republic of _)", 153 | "Serbia (Republic of _)", 154 | "Jordan (Hashemite Kingdom of _) (Kingdom of _)", 155 | "Portugal (Portuguese Republic)", 156 | "Hungary (Republic of _)", 157 | "South Korea (Republic of Korea) (Korea, South)", 158 | "Iceland", 159 | "Guatemala (Republic of _)", 160 | "Cuba (Republic of _)", 161 | "Bulgaria (Republic of _)", 162 | "Liberia (Republic of _)", 163 | "Honduras (Republic of _)", 164 | "Benin (Republic of _)", 165 | "Eritrea (State of _)", 166 | "Malawi (Republic of _)", 167 | "North Korea (Democratic People's Republic of Korea) (Korea, North)", 168 | "Nicaragua (Republic of _)", 169 | "Greece (Hellenic Republic) (Hellas)", 170 | "Tajikistan (Republic of _)", 171 | "Bangladesh (People's Republic of _)", 172 | "Nepal (Federal Democratic Republic of _)", 173 | "Tunisia (Tunisian Republic) (Republic of _)", 174 | "Suriname (Republic of _)", 175 | "Uruguay (Eastern Republic of _)", 176 | "Cambodia (Kingdom of _)", 177 | "Syria (Syrian Arab Republic)", 178 | "Senegal (Republic of _)", 179 | "Kyrgyzstan (Kyrgyz Republic)", 180 | "Belarus (Republic of _)", 181 | "Guyana (Co-operative Republic of _)", 182 | "Laos (Lao People's Democratic Republic)", 183 | "Romania", 184 | "Ghana (Republic of _)", 185 | "Uganda (Republic of _)", 186 | "United Kingdom (Scotland) (Great Britain) (England) (Northern Ireland) (Ireland, Northern) (Britain) (United Kingdom of Great Britain and Northern Ireland)", 187 | "Guinea (Republic of _) (Guinea-Conakry)", 188 | "Ecuador (Republic of _)", 189 | "Western Sahara (Sahrawi Arab Democratic Republic)", 190 | "Gabon (Gabonese Republic)", 191 | "New Zealand", 192 | "Burkina Faso", 193 | "Philippines (Republic of the _)", 194 | "Italy (Italian Republic)", 195 | "Oman (Sultanate of _)", 196 | "Poland (Republic of _)", 197 | "Ivory Coast (Cote d'Ivoire) (Republic of Cote d'Ivoire)", 198 | "Norway (Kingdom of _)", 199 | "Malaysia", 200 | "Vietnam (Socialist Republic of _)", 201 | "Finland (Republic of _)", 202 | "Congo-Brazzaville (West Congo) (Republic of the Congo)", 203 | "Germany (Federal Republic of _)", 204 | "Japan", 205 | "Zimbabwe (Republic of _)", 206 | "Paraguay (Republic of _)", 207 | "Iraq (Republic of _)", 208 | "Morocco (Kingdom of _)", 209 | "Uzbekistan (Republic of _)", 210 | "Sweden (Kingdom of _)", 211 | "Papua New Guinea (Independent State of _)", 212 | "Cameroon (Republic of _)", 213 | "Turkmenistan", 214 | "Spain (Kingdom of _)", 215 | "Thailand (Kingdom of _)", 216 | "Yemen (Republic of _)", 217 | "France (French Republic)", 218 | "Aaland Islands", 219 | "Kenya (Republic of _)", 220 | "Botswana (Republic of _)", 221 | "Madagascar (Republic of _)", 222 | "Ukraine", 223 | "South Sudan (Republic of _)", 224 | "Central African Republic", 225 | "Somalia (Federal Republic of _)", 226 | "Afghanistan (Islamic Republic of _)", 227 | "Myanmar (Republic of the Union of _) (Burma)", 228 | "Zambia (Republic of _)", 229 | "Chile (Republic of _)", 230 | "Turkey (Republic of _)", 231 | "Pakistan (Islamic Republic of _)", 232 | "Mozambique (Republic of _)", 233 | "Namibia (Republic of _)", 234 | "Venezuela (Bolivarian Republic of _)", 235 | "Nigeria (Federal Republic of _)", 236 | "Tanzania (United Republic of _)", 237 | "Egypt (Arab Republic of _)", 238 | "Mauritania (Islamic Republic of _)", 239 | "Bolivia (Plurinational State of _)", 240 | "Ethiopia (Federal Democratic Republic of _)", 241 | "Colombia (Republic of _)", 242 | "South Africa (Republic of _)", 243 | "Mali (Republic of _)", 244 | "Angola (Republic of _)", 245 | "Niger (Republic of _)", 246 | "Chad (Republic of _)", 247 | "Peru (Republic of _)", 248 | "Mongolia", 249 | "Iran (Persia) (Islamic Republic of _)", 250 | "Libya", 251 | "Sudan (Republic of the _)", 252 | "Indonesia (Republic of _)", 253 | "Federal District", 254 | "Tlaxcala", 255 | "Morelos", 256 | "Aguascalientes", 257 | "Colima", 258 | "Queretaro", 259 | "Hidalgo", 260 | "Mexico State", 261 | "Tabasco", 262 | "Nayarit", 263 | "Guanajuato", 264 | "Puebla", 265 | "Yucatan", 266 | "Quintana Roo", 267 | "Sinaloa", 268 | "Campeche", 269 | "Michoacan", 270 | "San Luis Potosi", 271 | "Guerrero", 272 | "Nuevo Leon (New Leon)", 273 | "Baja California", 274 | "Veracruz", 275 | "Chiapas", 276 | "Baja California Sur", 277 | "Zacatecas", 278 | "Jalisco", 279 | "Tamaulipas", 280 | "Oaxaca", 281 | "Durango", 282 | "Coahuila", 283 | "Sonora", 284 | "Chihuahua", 285 | "Greenland", 286 | "Saudi Arabia (Kingdom of _)", 287 | "Congo-Kinshasa (Democratic Republic of the Congo) (East Congo)", 288 | "Algeria (People's Democratic Republic of _)", 289 | "Kazakhstan (Republic of _)", 290 | "Argentina (Argentine Republic)", 291 | "Daman and Diu", 292 | "Dadra and Nagar Haveli (Dadra) (Nagar Haveli)", 293 | "Chandigarh", 294 | "Andaman and Nicobar (Andaman) (Nicobar)", 295 | "Lakshadweep", 296 | "Delhi (National Capital Territory of _)", 297 | "Meghalaya", 298 | "Nagaland", 299 | "Manipur", 300 | "Tripura", 301 | "Mizoram", 302 | "Sikkim", 303 | "Punjab", 304 | "Haryana", 305 | "Arunachal Pradesh", 306 | "Assam", 307 | "Bihar", 308 | "Uttarakhand", 309 | "Goa", 310 | "Kerala", 311 | "Tamil Nadu", 312 | "Himachal Pradesh", 313 | "Jammu and Kashmir (Jammu) (Kashmir)", 314 | "Chhattisgarh", 315 | "Jharkhand", 316 | "Karnataka", 317 | "Rajasthan", 318 | "Odisha (Orissa)", 319 | "Gujarat", 320 | "West Bengal", 321 | "Madhya Pradesh", 322 | "Telangana", 323 | "Andhra Pradesh", 324 | "Maharashtra", 325 | "Uttar Pradesh", 326 | "Puducherry", 327 | "New South Wales", 328 | "Australian Capital Territory", 329 | "Jervis Bay Territory", 330 | "Northern Territory", 331 | "South Australia", 332 | "Tasmania", 333 | "Victoria", 334 | "Western Australia", 335 | "Queensland", 336 | "Distrito Federal", 337 | "Sergipe", 338 | "Alagoas", 339 | "Rio de Janeiro", 340 | "Espirito Santo", 341 | "Rio Grande do Norte", 342 | "Paraiba", 343 | "Santa Catarina", 344 | "Pernambuco", 345 | "Amapa", 346 | "Ceara", 347 | "Acre", 348 | "Parana", 349 | "Roraima", 350 | "Rondonia", 351 | "Sao Paulo", 352 | "Piaui", 353 | "Tocantins", 354 | "Rio Grande do Sul", 355 | "Maranhao", 356 | "Goias", 357 | "Mato Grosso do Sul", 358 | "Bahia", 359 | "Minas Gerais", 360 | "Mato Grosso", 361 | "Para", 362 | "Amazonas", 363 | "District of Columbia (Washington, D.C.)", 364 | "Rhode Island", 365 | "Delaware", 366 | "Connecticut", 367 | "New Jersey", 368 | "New Hampshire", 369 | "Vermont", 370 | "Massachusetts (Commonwealth of _)", 371 | "Hawaii", 372 | "Maryland", 373 | "West Virginia", 374 | "South Carolina", 375 | "Maine", 376 | "Indiana", 377 | "Kentucky (Commonwealth of _)", 378 | "Tennessee", 379 | "Virginia (Commonwealth of _)", 380 | "Ohio", 381 | "Pennsylvania (Commonwealth of _)", 382 | "Mississippi", 383 | "Louisiana", 384 | "Alabama", 385 | "Arkansas", 386 | "North Carolina", 387 | "New York", 388 | "Iowa", 389 | "Illinois", 390 | "Georgia", 391 | "Wisconsin", 392 | "Florida", 393 | "Missouri", 394 | "Oklahoma", 395 | "North Dakota", 396 | "Washington", 397 | "South Dakota", 398 | "Nebraska", 399 | "Kansas", 400 | "Idaho", 401 | "Utah", 402 | "Minnesota", 403 | "Michigan", 404 | "Wyoming", 405 | "Oregon", 406 | "Colorado", 407 | "Nevada", 408 | "Arizona", 409 | "New Mexico", 410 | "Montana", 411 | "California", 412 | "Texas", 413 | "Alaska", 414 | "British Columbia", 415 | "Alberta", 416 | "Ontario", 417 | "Quebec", 418 | "Saskatchewan", 419 | "Manitoba", 420 | "Newfoundland and Labrador (Newfoundland) (Labrador)", 421 | "New Brunswick", 422 | "Nova Scotia", 423 | "Prince Edward Island", 424 | "Yukon", 425 | "Northwest Territories", 426 | "Nunavut", 427 | "India (Republic of _)", 428 | "Australia (Commonwealth of _)", 429 | "Brazil (Federative Republic of _)", 430 | "USA (United States of America) (America)", 431 | "Mexico (United Mexican States)", 432 | "Moscow", 433 | "Saint Petersburg", 434 | "Kaliningrad Oblast", 435 | "Ingushetia", 436 | "Adygea Republic", 437 | "North Ossetia-Alania Republic", 438 | "Kabardino-Balkar Republic", 439 | "Karachay-Cherkess Republic", 440 | "Chechen Republic (Chechnya) (Ichkeria)", 441 | "Chuvash Republic", 442 | "Ivanovo Oblast", 443 | "Lipetsk Oblast", 444 | "Oryol Oblast", 445 | "Tula Oblast", 446 | "Belgorod Oblast", 447 | "Vladimir Oblast", 448 | "Kursk Oblast", 449 | "Kaluga Oblast", 450 | "Tambov Oblast", 451 | "Bryansk Oblast", 452 | "Yaroslavl Oblast", 453 | "Ryazan Oblast", 454 | "Astrakhan Oblast", 455 | "Moscow Oblast", 456 | "Smolensk Oblast", 457 | "Dagestan Republic", 458 | "Voronezh Oblast", 459 | "Novgorod Oblast", 460 | "Pskov Oblast", 461 | "Kostroma Oblast", 462 | "Stavropol Krai", 463 | "Krasnodar Krai", 464 | "Kalmykia Republic", 465 | "Tver Oblast", 466 | "Leningrad Oblast", 467 | "Rostov Oblast", 468 | "Volgograd Oblast", 469 | "Vologda Oblast", 470 | "Murmansk Oblast", 471 | "Karelia Republic", 472 | "Nenets Autonomous Okrug", 473 | "Komi Republic", 474 | "Arkhangelsk Oblast", 475 | "Mordovia Republic", 476 | "Nizhny Novgorod Oblast", 477 | "Penza Oblast", 478 | "Kirov Oblast", 479 | "Mari El Republic", 480 | "Orenburg Oblast", 481 | "Ulyanovsk Oblast", 482 | "Perm Krai", 483 | "Bashkortostan Republic", 484 | "Udmurt Republic", 485 | "Tatarstan Republic", 486 | "Samara Oblast", 487 | "Saratov Oblast", 488 | "Yamalo-Nenets", 489 | "Khanty-Mansi", 490 | "Sverdlovsk Oblast", 491 | "Tyumen Oblast", 492 | "Kurgan Oblast", 493 | "Chelyabinsk Oblast", 494 | "Buryatia Republic", 495 | "Zabaykalsky Krai", 496 | "Irkutsk Oblast", 497 | "Novosibirsk Oblast", 498 | "Tomsk Oblast", 499 | "Omsk Oblast", 500 | "Khakassia Republic", 501 | "Kemerovo Oblast", 502 | "Altai Republic", 503 | "Altai Krai", 504 | "Tuva Republic", 505 | "Krasnoyarsk Krai", 506 | "Magadan Oblast", 507 | "Chukotka Okrug", 508 | "Kamchatka Krai", 509 | "Sakhalin Oblast", 510 | "Primorsky Krai", 511 | "Jewish Autonomous Oblast", 512 | "Khabarovsk Krai", 513 | "Amur Oblast", 514 | "Sakha Republic (Yakutia Republic)", 515 | "Canada", 516 | "Russia (Russian Federation)", 517 | "Shanghai Municipality", 518 | "Tianjin Municipality", 519 | "Beijing Municipality", 520 | "Hainan Province", 521 | "Ningxia Hui Autonomous Region", 522 | "Chongqing Municipality", 523 | "Zhejiang Province", 524 | "Jiangsu Province", 525 | "Fujian Province", 526 | "Anhui Province", 527 | "Liaoning Province", 528 | "Shandong Province", 529 | "Shanxi Province", 530 | "Jiangxi Province", 531 | "Henan Province", 532 | "Guizhou Province", 533 | "Guangdong Province", 534 | "Hubei Province", 535 | "Jilin Province", 536 | "Hebei Province (Yanzhao Province)", 537 | "Shaanxi Province", 538 | "Nei Mongol Autonomous Region (Inner Mongolia)", 539 | "Heilongjiang Province", 540 | "Hunan Province", 541 | "Guangxi Zhuang Autonomous Region", 542 | "Sichuan Province", 543 | "Yunnan Province", 544 | "Xizang Autonomous Region (Tibet)", 545 | "Gansu Province", 546 | "Qinghai Province (Tsinghai Province)", 547 | "Xinjiang Uyghur Autonomous Region", 548 | "China (People's Republic of _)", 549 | "United States Minor Outlying Islands", 550 | "Clipperton Island", 551 | "Antarctica", 552 | "International (Worldwide) (Earth)", 553 | "?"]; 554 | 555 | -------------------------------------------------------------------------------- /ctrynams_short.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2018 Stichting Mapcode Foundation (http://www.mapcode.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // *** GENERATED FILE (coords.cpp), DO NOT CHANGE OR PRETTIFY *** 18 | 19 | var isofullname = [ 20 | "Vatican (Holy See)", 21 | "Monaco", 22 | "Gibraltar", 23 | "Tokelau", 24 | "Cocos Islands (Keeling Islands)", 25 | "Saint-Barthelemy", 26 | "Nauru", 27 | "Tuvalu", 28 | "Macau (Aomen)", 29 | "Sint Maarten", 30 | "Saint Martin", 31 | "Norfolk and Philip Island (Philip Island) (Norfolk Island)", 32 | "Pitcairn Islands (Pitcairn, Henderson, Ducie and Oeno Islands)", 33 | "Bouvet Island", 34 | "Bermuda (Somers Isles)", 35 | "British Indian Ocean Territory", 36 | "San Marino", 37 | "Guernsey", 38 | "Anguilla", 39 | "Montserrat", 40 | "Jersey", 41 | "Christmas Island", 42 | "Wallis and Futuna (Futuna) (Wallis)", 43 | "British Virgin Islands (Virgin Islands, British)", 44 | "Liechtenstein", 45 | "Aruba", 46 | "Marshall Islands", 47 | "American Samoa (Samoa, American)", 48 | "Cook Islands", 49 | "Saint Pierre and Miquelon (Miquelon) (Saint Pierre)", 50 | "Niue", 51 | "Saint Kitts and Nevis (Nevis) (Saint Kitts)", 52 | "Cayman islands", 53 | "Bonaire, St Eustasuis and Saba (Bonaire) (Saba) (St Eustasius)", 54 | "Maldives", 55 | "Saint Helena, Ascension and Tristan da Cunha (Saint Helena) (Ascension) (Tristan da Cunha)", 56 | "Malta", 57 | "Grenada", 58 | "Virgin Islands of the United States (US Virgin Islands) (American Virgin Islands)", 59 | "Mayotte (Maore)", 60 | "Svalbard and Jan Mayen (Svalbard) (Jan Mayen) (Spitsbergen)", 61 | "Saint Vincent and the Grenadines (Saint Vincent) (Grenadines)", 62 | "Heard Island and McDonald Islands (Heard Island) (McDonald Islands)", 63 | "Barbados", 64 | "Antigua and Barbuda (Antigua) (Barbuda)", 65 | "Curacao", 66 | "Seychelles", 67 | "Palau", 68 | "Northern Mariana Islands", 69 | "Andorra", 70 | "Guam", 71 | "Isle of Mann (Mann)", 72 | "Saint Lucia", 73 | "Micronesia (Federated States of Micronesia)", 74 | "Singapore", 75 | "Tonga", 76 | "Dominica", 77 | "Bahrain", 78 | "Kiribati", 79 | "Turks and Caicos Islands (Turks Islands) (Caicos Islands)", 80 | "Sao Tome and Principe (Sao Tome) (Principe)", 81 | "Hong Kong (Xianggang)", 82 | "Martinique", 83 | "Faroe Islands", 84 | "Guadeloupe", 85 | "Comoros", 86 | "Mauritius", 87 | "Reunion", 88 | "Luxembourg", 89 | "Samoa", 90 | "South Georgia and the South Sandwich Islands (South Georgia) (South Sandwich Islands)", 91 | "French Polynesia", 92 | "Cape Verde (Cabo Verde) (Republic of Cabo Verde)", 93 | "Trinidad and Tobago (Trinidad) (Tobago)", 94 | "Brunei", 95 | "French Southern and Antarctic Lands", 96 | "Puerto Rico", 97 | "Cyprus", 98 | "Lebanon (Lebanese Republic)", 99 | "Jamaica", 100 | "Gambia (The Gambia)", 101 | "Qatar", 102 | "Falkland Islands (The Falklands)", 103 | "Vanuatu", 104 | "Montenegro", 105 | "Bahamas", 106 | "Timor-Leste (East Timor)", 107 | "Swaziland", 108 | "Kuwait", 109 | "Fiji", 110 | "New Caledonia", 111 | "Slovenia", 112 | "Israel", 113 | "Palestinian territories (State of Palestine)", 114 | "El Salvador", 115 | "Belize", 116 | "Djibouti", 117 | "Macedonia (FYROM) (Former Yugoslav Republic of Macedonia)", 118 | "Rwanda", 119 | "Haiti", 120 | "Burundi", 121 | "Equatorial Guinea", 122 | "Albania", 123 | "Solomon Islands", 124 | "Armenia", 125 | "Lesotho", 126 | "Belgium", 127 | "Moldova", 128 | "Guinea-Bissau", 129 | "Taiwan (Republic of China)", 130 | "Bhutan", 131 | "Switzerland (Swiss Confederation)", 132 | "Netherlands (The Netherlands)", 133 | "Denmark", 134 | "Estonia", 135 | "Dominican Republic", 136 | "Slovakia (Slovak Republic)", 137 | "Costa Rica", 138 | "Bosnia and Herzegovina", 139 | "Croatia", 140 | "Togo (Togolese Republic)", 141 | "Latvia", 142 | "Lithuania", 143 | "Sri Lanka", 144 | "Georgia", 145 | "Ireland", 146 | "Sierra Leone", 147 | "Panama", 148 | "Czech Republic", 149 | "French Guiana (Guiana)", 150 | "United Arab Emirates (Emirates)", 151 | "Austria", 152 | "Azerbaijan", 153 | "Serbia", 154 | "Jordan", 155 | "Portugal (Portuguese Republic)", 156 | "Hungary", 157 | "South Korea (Republic of Korea) (Korea, South)", 158 | "Iceland", 159 | "Guatemala", 160 | "Cuba", 161 | "Bulgaria", 162 | "Liberia", 163 | "Honduras", 164 | "Benin", 165 | "Eritrea", 166 | "Malawi", 167 | "North Korea (Democratic People's Republic of Korea) (Korea, North)", 168 | "Nicaragua", 169 | "Greece (Hellenic Republic) (Hellas)", 170 | "Tajikistan", 171 | "Bangladesh", 172 | "Nepal", 173 | "Tunisia (Tunisian Republic)", 174 | "Suriname", 175 | "Uruguay", 176 | "Cambodia", 177 | "Syria (Syrian Arab Republic)", 178 | "Senegal", 179 | "Kyrgyzstan (Kyrgyz Republic)", 180 | "Belarus", 181 | "Guyana", 182 | "Laos (Lao People's Democratic Republic)", 183 | "Romania", 184 | "Ghana", 185 | "Uganda", 186 | "United Kingdom (Scotland) (Great Britain) (England) (Northern Ireland) (Ireland, Northern) (Britain) (United Kingdom of Great Britain and Northern Ireland)", 187 | "Guinea (Guinea-Conakry)", 188 | "Ecuador", 189 | "Western Sahara (Sahrawi Arab Democratic Republic)", 190 | "Gabon (Gabonese Republic)", 191 | "New Zealand", 192 | "Burkina Faso", 193 | "Philippines", 194 | "Italy (Italian Republic)", 195 | "Oman", 196 | "Poland", 197 | "Ivory Coast (Cote d'Ivoire) (Republic of Cote d'Ivoire)", 198 | "Norway", 199 | "Malaysia", 200 | "Vietnam", 201 | "Finland", 202 | "Congo-Brazzaville (West Congo) (Republic of the Congo)", 203 | "Germany", 204 | "Japan", 205 | "Zimbabwe", 206 | "Paraguay", 207 | "Iraq", 208 | "Morocco", 209 | "Uzbekistan", 210 | "Sweden", 211 | "Papua New Guinea", 212 | "Cameroon", 213 | "Turkmenistan", 214 | "Spain", 215 | "Thailand", 216 | "Yemen", 217 | "France (French Republic)", 218 | "Aaland Islands", 219 | "Kenya", 220 | "Botswana", 221 | "Madagascar", 222 | "Ukraine", 223 | "South Sudan", 224 | "Central African Republic", 225 | "Somalia", 226 | "Afghanistan", 227 | "Myanmar (Burma)", 228 | "Zambia", 229 | "Chile", 230 | "Turkey", 231 | "Pakistan", 232 | "Mozambique", 233 | "Namibia", 234 | "Venezuela", 235 | "Nigeria", 236 | "Tanzania", 237 | "Egypt", 238 | "Mauritania", 239 | "Bolivia", 240 | "Ethiopia", 241 | "Colombia", 242 | "South Africa", 243 | "Mali", 244 | "Angola", 245 | "Niger", 246 | "Chad", 247 | "Peru", 248 | "Mongolia", 249 | "Iran (Persia)", 250 | "Libya", 251 | "Sudan", 252 | "Indonesia", 253 | "Federal District", 254 | "Tlaxcala", 255 | "Morelos", 256 | "Aguascalientes", 257 | "Colima", 258 | "Queretaro", 259 | "Hidalgo", 260 | "Mexico State", 261 | "Tabasco", 262 | "Nayarit", 263 | "Guanajuato", 264 | "Puebla", 265 | "Yucatan", 266 | "Quintana Roo", 267 | "Sinaloa", 268 | "Campeche", 269 | "Michoacan", 270 | "San Luis Potosi", 271 | "Guerrero", 272 | "Nuevo Leon (New Leon)", 273 | "Baja California", 274 | "Veracruz", 275 | "Chiapas", 276 | "Baja California Sur", 277 | "Zacatecas", 278 | "Jalisco", 279 | "Tamaulipas", 280 | "Oaxaca", 281 | "Durango", 282 | "Coahuila", 283 | "Sonora", 284 | "Chihuahua", 285 | "Greenland", 286 | "Saudi Arabia", 287 | "Congo-Kinshasa (Democratic Republic of the Congo) (East Congo)", 288 | "Algeria", 289 | "Kazakhstan", 290 | "Argentina (Argentine Republic)", 291 | "Daman and Diu", 292 | "Dadra and Nagar Haveli (Dadra) (Nagar Haveli)", 293 | "Chandigarh", 294 | "Andaman and Nicobar (Andaman) (Nicobar)", 295 | "Lakshadweep", 296 | "Delhi", 297 | "Meghalaya", 298 | "Nagaland", 299 | "Manipur", 300 | "Tripura", 301 | "Mizoram", 302 | "Sikkim", 303 | "Punjab", 304 | "Haryana", 305 | "Arunachal Pradesh", 306 | "Assam", 307 | "Bihar", 308 | "Uttarakhand", 309 | "Goa", 310 | "Kerala", 311 | "Tamil Nadu", 312 | "Himachal Pradesh", 313 | "Jammu and Kashmir (Jammu) (Kashmir)", 314 | "Chhattisgarh", 315 | "Jharkhand", 316 | "Karnataka", 317 | "Rajasthan", 318 | "Odisha (Orissa)", 319 | "Gujarat", 320 | "West Bengal", 321 | "Madhya Pradesh", 322 | "Telangana", 323 | "Andhra Pradesh", 324 | "Maharashtra", 325 | "Uttar Pradesh", 326 | "Puducherry", 327 | "New South Wales", 328 | "Australian Capital Territory", 329 | "Jervis Bay Territory", 330 | "Northern Territory", 331 | "South Australia", 332 | "Tasmania", 333 | "Victoria", 334 | "Western Australia", 335 | "Queensland", 336 | "Distrito Federal", 337 | "Sergipe", 338 | "Alagoas", 339 | "Rio de Janeiro", 340 | "Espirito Santo", 341 | "Rio Grande do Norte", 342 | "Paraiba", 343 | "Santa Catarina", 344 | "Pernambuco", 345 | "Amapa", 346 | "Ceara", 347 | "Acre", 348 | "Parana", 349 | "Roraima", 350 | "Rondonia", 351 | "Sao Paulo", 352 | "Piaui", 353 | "Tocantins", 354 | "Rio Grande do Sul", 355 | "Maranhao", 356 | "Goias", 357 | "Mato Grosso do Sul", 358 | "Bahia", 359 | "Minas Gerais", 360 | "Mato Grosso", 361 | "Para", 362 | "Amazonas", 363 | "District of Columbia (Washington, D.C.)", 364 | "Rhode Island", 365 | "Delaware", 366 | "Connecticut", 367 | "New Jersey", 368 | "New Hampshire", 369 | "Vermont", 370 | "Massachusetts", 371 | "Hawaii", 372 | "Maryland", 373 | "West Virginia", 374 | "South Carolina", 375 | "Maine", 376 | "Indiana", 377 | "Kentucky", 378 | "Tennessee", 379 | "Virginia", 380 | "Ohio", 381 | "Pennsylvania", 382 | "Mississippi", 383 | "Louisiana", 384 | "Alabama", 385 | "Arkansas", 386 | "North Carolina", 387 | "New York", 388 | "Iowa", 389 | "Illinois", 390 | "Georgia", 391 | "Wisconsin", 392 | "Florida", 393 | "Missouri", 394 | "Oklahoma", 395 | "North Dakota", 396 | "Washington", 397 | "South Dakota", 398 | "Nebraska", 399 | "Kansas", 400 | "Idaho", 401 | "Utah", 402 | "Minnesota", 403 | "Michigan", 404 | "Wyoming", 405 | "Oregon", 406 | "Colorado", 407 | "Nevada", 408 | "Arizona", 409 | "New Mexico", 410 | "Montana", 411 | "California", 412 | "Texas", 413 | "Alaska", 414 | "British Columbia", 415 | "Alberta", 416 | "Ontario", 417 | "Quebec", 418 | "Saskatchewan", 419 | "Manitoba", 420 | "Newfoundland and Labrador (Newfoundland) (Labrador)", 421 | "New Brunswick", 422 | "Nova Scotia", 423 | "Prince Edward Island", 424 | "Yukon", 425 | "Northwest Territories", 426 | "Nunavut", 427 | "India", 428 | "Australia", 429 | "Brazil", 430 | "USA (United States of America) (America)", 431 | "Mexico (United Mexican States)", 432 | "Moscow", 433 | "Saint Petersburg", 434 | "Kaliningrad Oblast", 435 | "Ingushetia", 436 | "Adygea Republic", 437 | "North Ossetia-Alania Republic", 438 | "Kabardino-Balkar Republic", 439 | "Karachay-Cherkess Republic", 440 | "Chechen Republic (Chechnya) (Ichkeria)", 441 | "Chuvash Republic", 442 | "Ivanovo Oblast", 443 | "Lipetsk Oblast", 444 | "Oryol Oblast", 445 | "Tula Oblast", 446 | "Belgorod Oblast", 447 | "Vladimir Oblast", 448 | "Kursk Oblast", 449 | "Kaluga Oblast", 450 | "Tambov Oblast", 451 | "Bryansk Oblast", 452 | "Yaroslavl Oblast", 453 | "Ryazan Oblast", 454 | "Astrakhan Oblast", 455 | "Moscow Oblast", 456 | "Smolensk Oblast", 457 | "Dagestan Republic", 458 | "Voronezh Oblast", 459 | "Novgorod Oblast", 460 | "Pskov Oblast", 461 | "Kostroma Oblast", 462 | "Stavropol Krai", 463 | "Krasnodar Krai", 464 | "Kalmykia Republic", 465 | "Tver Oblast", 466 | "Leningrad Oblast", 467 | "Rostov Oblast", 468 | "Volgograd Oblast", 469 | "Vologda Oblast", 470 | "Murmansk Oblast", 471 | "Karelia Republic", 472 | "Nenets Autonomous Okrug", 473 | "Komi Republic", 474 | "Arkhangelsk Oblast", 475 | "Mordovia Republic", 476 | "Nizhny Novgorod Oblast", 477 | "Penza Oblast", 478 | "Kirov Oblast", 479 | "Mari El Republic", 480 | "Orenburg Oblast", 481 | "Ulyanovsk Oblast", 482 | "Perm Krai", 483 | "Bashkortostan Republic", 484 | "Udmurt Republic", 485 | "Tatarstan Republic", 486 | "Samara Oblast", 487 | "Saratov Oblast", 488 | "Yamalo-Nenets", 489 | "Khanty-Mansi", 490 | "Sverdlovsk Oblast", 491 | "Tyumen Oblast", 492 | "Kurgan Oblast", 493 | "Chelyabinsk Oblast", 494 | "Buryatia Republic", 495 | "Zabaykalsky Krai", 496 | "Irkutsk Oblast", 497 | "Novosibirsk Oblast", 498 | "Tomsk Oblast", 499 | "Omsk Oblast", 500 | "Khakassia Republic", 501 | "Kemerovo Oblast", 502 | "Altai Republic", 503 | "Altai Krai", 504 | "Tuva Republic", 505 | "Krasnoyarsk Krai", 506 | "Magadan Oblast", 507 | "Chukotka Okrug", 508 | "Kamchatka Krai", 509 | "Sakhalin Oblast", 510 | "Primorsky Krai", 511 | "Jewish Autonomous Oblast", 512 | "Khabarovsk Krai", 513 | "Amur Oblast", 514 | "Sakha Republic (Yakutia Republic)", 515 | "Canada", 516 | "Russia (Russian Federation)", 517 | "Shanghai", 518 | "Tianjin", 519 | "Beijing", 520 | "Hainan", 521 | "Ningxia Hui", 522 | "Chongqing", 523 | "Zhejiang", 524 | "Jiangsu", 525 | "Fujian", 526 | "Anhui", 527 | "Liaoning", 528 | "Shandong", 529 | "Shanxi", 530 | "Jiangxi", 531 | "Henan", 532 | "Guizhou", 533 | "Guangdong", 534 | "Hubei", 535 | "Jilin", 536 | "Hebei (Yanzhao)", 537 | "Shaanxi", 538 | "Nei Mongol (Inner Mongolia)", 539 | "Heilongjiang", 540 | "Hunan", 541 | "Guangxi Zhuang", 542 | "Sichuan", 543 | "Yunnan", 544 | "Xizang (Tibet)", 545 | "Gansu", 546 | "Qinghai (Tsinghai)", 547 | "Xinjiang Uyghur", 548 | "China", 549 | "United States Minor Outlying Islands", 550 | "Clipperton Island", 551 | "Antarctica", 552 | "International (Worldwide) (Earth)", 553 | "?"]; 554 | 555 | -------------------------------------------------------------------------------- /examples/FileSaver.js: -------------------------------------------------------------------------------- 1 | /* FileSaver.js 2 | * A saveAs() FileSaver implementation. 3 | * 1.3.2 4 | * 2016-06-16 18:25:19 5 | * 6 | * By Eli Grey, http://eligrey.com 7 | * License: MIT 8 | * See https://github.com/eligrey/FileSaver.js/blob/master/LICENSE.md 9 | */ 10 | 11 | /*global self */ 12 | /*jslint bitwise: true, indent: 4, laxbreak: true, laxcomma: true, smarttabs: true, plusplus: true */ 13 | 14 | /*! @source http://purl.eligrey.com/github/FileSaver.js/blob/master/FileSaver.js */ 15 | 16 | var saveAs = saveAs || (function(view) { 17 | "use strict"; 18 | // IE <10 is explicitly unsupported 19 | if (typeof view === "undefined" || typeof navigator !== "undefined" && /MSIE [1-9]\./.test(navigator.userAgent)) { 20 | return; 21 | } 22 | var 23 | doc = view.document 24 | // only get URL when necessary in case Blob.js hasn't overridden it yet 25 | , get_URL = function() { 26 | return view.URL || view.webkitURL || view; 27 | } 28 | , save_link = doc.createElementNS("http://www.w3.org/1999/xhtml", "a") 29 | , can_use_save_link = "download" in save_link 30 | , click = function(node) { 31 | var event = new MouseEvent("click"); 32 | node.dispatchEvent(event); 33 | } 34 | , is_safari = /constructor/i.test(view.HTMLElement) || view.safari 35 | , is_chrome_ios =/CriOS\/[\d]+/.test(navigator.userAgent) 36 | , throw_outside = function(ex) { 37 | (view.setImmediate || view.setTimeout)(function() { 38 | throw ex; 39 | }, 0); 40 | } 41 | , force_saveable_type = "application/octet-stream" 42 | // the Blob API is fundamentally broken as there is no "downloadfinished" event to subscribe to 43 | , arbitrary_revoke_timeout = 1000 * 40 // in ms 44 | , revoke = function(file) { 45 | var revoker = function() { 46 | if (typeof file === "string") { // file is an object URL 47 | get_URL().revokeObjectURL(file); 48 | } else { // file is a File 49 | file.remove(); 50 | } 51 | }; 52 | setTimeout(revoker, arbitrary_revoke_timeout); 53 | } 54 | , dispatch = function(filesaver, event_types, event) { 55 | event_types = [].concat(event_types); 56 | var i = event_types.length; 57 | while (i--) { 58 | var listener = filesaver["on" + event_types[i]]; 59 | if (typeof listener === "function") { 60 | try { 61 | listener.call(filesaver, event || filesaver); 62 | } catch (ex) { 63 | throw_outside(ex); 64 | } 65 | } 66 | } 67 | } 68 | , auto_bom = function(blob) { 69 | // prepend BOM for UTF-8 XML and text/* types (including HTML) 70 | // note: your browser will automatically convert UTF-16 U+FEFF to EF BB BF 71 | if (/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) { 72 | return new Blob([String.fromCharCode(0xFEFF), blob], {type: blob.type}); 73 | } 74 | return blob; 75 | } 76 | , FileSaver = function(blob, name, no_auto_bom) { 77 | if (!no_auto_bom) { 78 | blob = auto_bom(blob); 79 | } 80 | // First try a.download, then web filesystem, then object URLs 81 | var 82 | filesaver = this 83 | , type = blob.type 84 | , force = type === force_saveable_type 85 | , object_url 86 | , dispatch_all = function() { 87 | dispatch(filesaver, "writestart progress write writeend".split(" ")); 88 | } 89 | // on any filesys errors revert to saving with object URLs 90 | , fs_error = function() { 91 | if ((is_chrome_ios || (force && is_safari)) && view.FileReader) { 92 | // Safari doesn't allow downloading of blob urls 93 | var reader = new FileReader(); 94 | reader.onloadend = function() { 95 | var url = is_chrome_ios ? reader.result : reader.result.replace(/^data:[^;]*;/, 'data:attachment/file;'); 96 | var popup = view.open(url, '_blank'); 97 | if(!popup) view.location.href = url; 98 | url=undefined; // release reference before dispatching 99 | filesaver.readyState = filesaver.DONE; 100 | dispatch_all(); 101 | }; 102 | reader.readAsDataURL(blob); 103 | filesaver.readyState = filesaver.INIT; 104 | return; 105 | } 106 | // don't create more object URLs than needed 107 | if (!object_url) { 108 | object_url = get_URL().createObjectURL(blob); 109 | } 110 | if (force) { 111 | view.location.href = object_url; 112 | } else { 113 | var opened = view.open(object_url, "_blank"); 114 | if (!opened) { 115 | // Apple does not allow window.open, see https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/WorkingwithWindowsandTabs/WorkingwithWindowsandTabs.html 116 | view.location.href = object_url; 117 | } 118 | } 119 | filesaver.readyState = filesaver.DONE; 120 | dispatch_all(); 121 | revoke(object_url); 122 | } 123 | ; 124 | filesaver.readyState = filesaver.INIT; 125 | 126 | if (can_use_save_link) { 127 | object_url = get_URL().createObjectURL(blob); 128 | setTimeout(function() { 129 | save_link.href = object_url; 130 | save_link.download = name; 131 | click(save_link); 132 | dispatch_all(); 133 | revoke(object_url); 134 | filesaver.readyState = filesaver.DONE; 135 | }); 136 | return; 137 | } 138 | 139 | fs_error(); 140 | } 141 | , FS_proto = FileSaver.prototype 142 | , saveAs = function(blob, name, no_auto_bom) { 143 | return new FileSaver(blob, name || blob.name || "download", no_auto_bom); 144 | } 145 | ; 146 | // IE 10+ (native saveAs) 147 | if (typeof navigator !== "undefined" && navigator.msSaveOrOpenBlob) { 148 | return function(blob, name, no_auto_bom) { 149 | name = name || blob.name || "download"; 150 | 151 | if (!no_auto_bom) { 152 | blob = auto_bom(blob); 153 | } 154 | return navigator.msSaveOrOpenBlob(blob, name); 155 | }; 156 | } 157 | 158 | FS_proto.abort = function(){}; 159 | FS_proto.readyState = FS_proto.INIT = 0; 160 | FS_proto.WRITING = 1; 161 | FS_proto.DONE = 2; 162 | 163 | FS_proto.error = 164 | FS_proto.onwritestart = 165 | FS_proto.onprogress = 166 | FS_proto.onwrite = 167 | FS_proto.onabort = 168 | FS_proto.onerror = 169 | FS_proto.onwriteend = 170 | null; 171 | 172 | return saveAs; 173 | }( 174 | typeof self !== "undefined" && self 175 | || typeof window !== "undefined" && window 176 | || this.content 177 | )); 178 | // `self` is undefined in Firefox for Android content script context 179 | // while `this` is nsIContentFrameMessageManager 180 | // with an attribute `content` that corresponds to the window 181 | 182 | if (typeof module !== "undefined" && module.exports) { 183 | module.exports.saveAs = saveAs; 184 | } else if ((typeof define !== "undefined" && define !== null) && (define.amd !== null)) { 185 | define("FileSaver.js", function() { 186 | return saveAs; 187 | }); 188 | } 189 | -------------------------------------------------------------------------------- /examples/converter.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | Simple Mapcode CSV Converter 23 | 24 | 25 | 26 |

Simple Mapcode CSV Converter

27 |

28 | This page allows you to upload a CSV file with coordinates and convert 29 | them to mapcodes, also in CSV format. The input CSV file needs to have 3 columns:
30 | latitude (in degrees), longitude (in degrees), territory (optional)
31 | Field delimiter: , (comma)
32 | Decimal point: . (dot)
33 |

34 |

35 | The column context is used to specify the 36 | territory code for which the shortest mapcode should be displayed. 37 | For example, for South Africa, this would be ZAF. Note that if you leave the field empty, the result might 38 | not be what you expected. The system may choose a nearby territory instead. 39 |

40 |

Example of an input CSV file:

41 |

42 | -28.700225, 28.602905, (note the territory is missing)
43 | -28.700225, 28.602905, ZAF
44 | -28.433676, 19.986191, ZAF 45 |

46 |

This produces the following output:

47 |

48 | latitude,longitude,mapcode,international
49 | -28.700225,28.602905,LSO MRG.8XX,8KYVG.4C8Y
50 | -28.700225,28.602905,ZAF QNW2.Y72,8KYVG.4C8Y
51 | -28.433676,19.986191,ZAF 6MQP.506,8K70Z.7PB4 52 |

53 |

54 | The output is formatted in CSV format. In some browsers this will automatically be saved to a file called 55 | mapcodes.csv in your Downloads folder. 56 | However, not all browsers support this functionality. Some will show the contents of the file on your screen 57 | instead and you'll need to copy or save it to a CSV file yourself then. 58 | (Note: We've tried this with Google Chrome and it seems to work fine.) 59 |

60 |

61 | Troubleshooting: If you select a CSV file and nothing happens, the format of the input file is not OK. 62 | It should contain exactly 3 columns, separated by comma's and the latitude/longitudes must use decimal points. 63 | Try saving the example text from above in a file and use that first, in that case.
64 | Note that this page is just an example. If you wish to have better error checking and more options, feel 65 | free to use and adapt the source files to your needs. 66 | They can be found here on Github. 67 |

68 |

69 | Useful links:
70 | List of territory codes
71 | Source files on Github 72 |

73 | 74 |
75 | 76 |
77 |
78 | 79 | 80 |
81 | 82 |
83 | 84 | 85 | 86 | 87 | 88 | 89 | 185 | 186 | 187 | 188 | -------------------------------------------------------------------------------- /examples/jquery.csv.js: -------------------------------------------------------------------------------- 1 | /** 2 | * jQuery-csv (jQuery Plugin) 3 | * 4 | * This document is licensed as free software under the terms of the 5 | * MIT License: http://www.opensource.org/licenses/mit-license.php 6 | * 7 | * Acknowledgements: 8 | * The original design and influence to implement this library as a jquery 9 | * plugin is influenced by jquery-json (http://code.google.com/p/jquery-json/). 10 | * If you're looking to use native JSON.Stringify but want additional backwards 11 | * compatibility for browsers that don't support it, I highly recommend you 12 | * check it out. 13 | * 14 | * A special thanks goes out to rwk@acm.org for providing a lot of valuable 15 | * feedback to the project including the core for the new FSM 16 | * (Finite State Machine) parsers. If you're looking for a stable TSV parser 17 | * be sure to take a look at jquery-tsv (http://code.google.com/p/jquery-tsv/). 18 | 19 | * For legal purposes I'll include the "NO WARRANTY EXPRESSED OR IMPLIED. 20 | * USE AT YOUR OWN RISK.". Which, in 'layman's terms' means, by using this 21 | * library you are accepting responsibility if it breaks your code. 22 | * 23 | * Legal jargon aside, I will do my best to provide a useful and stable core 24 | * that can effectively be built on. 25 | * 26 | * Copyrighted 2012 by Evan Plaice. 27 | */ 28 | 29 | RegExp.escape= function(s) { 30 | return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); 31 | }; 32 | 33 | (function (undefined) { 34 | 'use strict'; 35 | 36 | var $; 37 | 38 | // to keep backwards compatibility 39 | if (typeof jQuery !== 'undefined' && jQuery) { 40 | $ = jQuery; 41 | } else { 42 | $ = {}; 43 | } 44 | 45 | 46 | /** 47 | * jQuery.csv.defaults 48 | * Encapsulates the method paramater defaults for the CSV plugin module. 49 | */ 50 | 51 | $.csv = { 52 | defaults: { 53 | separator:',', 54 | delimiter:'"', 55 | headers:true 56 | }, 57 | 58 | hooks: { 59 | castToScalar: function(value, state) { 60 | var hasDot = /\./; 61 | if (isNaN(value)) { 62 | return value; 63 | } else { 64 | if (hasDot.test(value)) { 65 | return parseFloat(value); 66 | } else { 67 | var integer = parseInt(value); 68 | if(isNaN(integer)) { 69 | return null; 70 | } else { 71 | return integer; 72 | } 73 | } 74 | } 75 | } 76 | }, 77 | 78 | parsers: { 79 | parse: function(csv, options) { 80 | // cache settings 81 | var separator = options.separator; 82 | var delimiter = options.delimiter; 83 | 84 | // set initial state if it's missing 85 | if(!options.state.rowNum) { 86 | options.state.rowNum = 1; 87 | } 88 | if(!options.state.colNum) { 89 | options.state.colNum = 1; 90 | } 91 | 92 | // clear initial state 93 | var data = []; 94 | var entry = []; 95 | var state = 0; 96 | var value = ''; 97 | var exit = false; 98 | 99 | function endOfEntry() { 100 | // reset the state 101 | state = 0; 102 | value = ''; 103 | 104 | // if 'start' hasn't been met, don't output 105 | if(options.start && options.state.rowNum < options.start) { 106 | // update global state 107 | entry = []; 108 | options.state.rowNum++; 109 | options.state.colNum = 1; 110 | return; 111 | } 112 | 113 | if(options.onParseEntry === undefined) { 114 | // onParseEntry hook not set 115 | data.push(entry); 116 | } else { 117 | var hookVal = options.onParseEntry(entry, options.state); // onParseEntry Hook 118 | // false skips the row, configurable through a hook 119 | if(hookVal !== false) { 120 | data.push(hookVal); 121 | } 122 | } 123 | //console.log('entry:' + entry); 124 | 125 | // cleanup 126 | entry = []; 127 | 128 | // if 'end' is met, stop parsing 129 | if(options.end && options.state.rowNum >= options.end) { 130 | exit = true; 131 | } 132 | 133 | // update global state 134 | options.state.rowNum++; 135 | options.state.colNum = 1; 136 | } 137 | 138 | function endOfValue() { 139 | if(options.onParseValue === undefined) { 140 | // onParseValue hook not set 141 | entry.push(value); 142 | } else { 143 | var hook = options.onParseValue(value, options.state); // onParseValue Hook 144 | // false skips the row, configurable through a hook 145 | if(hook !== false) { 146 | entry.push(hook); 147 | } 148 | } 149 | //console.log('value:' + value); 150 | // reset the state 151 | value = ''; 152 | state = 0; 153 | // update global state 154 | options.state.colNum++; 155 | } 156 | 157 | // escape regex-specific control chars 158 | var escSeparator = RegExp.escape(separator); 159 | var escDelimiter = RegExp.escape(delimiter); 160 | 161 | // compile the regEx str using the custom delimiter/separator 162 | var match = /(D|S|\r\n|\n|\r|[^DS\r\n]+)/; 163 | var matchSrc = match.source; 164 | matchSrc = matchSrc.replace(/S/g, escSeparator); 165 | matchSrc = matchSrc.replace(/D/g, escDelimiter); 166 | match = new RegExp(matchSrc, 'gm'); 167 | 168 | // put on your fancy pants... 169 | // process control chars individually, use look-ahead on non-control chars 170 | csv.replace(match, function (m0) { 171 | if(exit) { 172 | return; 173 | } 174 | switch (state) { 175 | // the start of a value 176 | case 0: 177 | // null last value 178 | if (m0 === separator) { 179 | value += ''; 180 | endOfValue(); 181 | break; 182 | } 183 | // opening delimiter 184 | if (m0 === delimiter) { 185 | state = 1; 186 | break; 187 | } 188 | // null last value 189 | if (/^(\r\n|\n|\r)$/.test(m0)) { 190 | endOfValue(); 191 | endOfEntry(); 192 | break; 193 | } 194 | // un-delimited value 195 | value += m0; 196 | state = 3; 197 | break; 198 | 199 | // delimited input 200 | case 1: 201 | // second delimiter? check further 202 | if (m0 === delimiter) { 203 | state = 2; 204 | break; 205 | } 206 | // delimited data 207 | value += m0; 208 | state = 1; 209 | break; 210 | 211 | // delimiter found in delimited input 212 | case 2: 213 | // escaped delimiter? 214 | if (m0 === delimiter) { 215 | value += m0; 216 | state = 1; 217 | break; 218 | } 219 | // null value 220 | if (m0 === separator) { 221 | endOfValue(); 222 | break; 223 | } 224 | // end of entry 225 | if (/^(\r\n|\n|\r)$/.test(m0)) { 226 | endOfValue(); 227 | endOfEntry(); 228 | break; 229 | } 230 | // broken paser? 231 | throw new Error('CSVDataError: Illegal State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 232 | 233 | // un-delimited input 234 | case 3: 235 | // null last value 236 | if (m0 === separator) { 237 | endOfValue(); 238 | break; 239 | } 240 | // end of entry 241 | if (/^(\r\n|\n|\r)$/.test(m0)) { 242 | endOfValue(); 243 | endOfEntry(); 244 | break; 245 | } 246 | if (m0 === delimiter) { 247 | // non-compliant data 248 | throw new Error('CSVDataError: Illegal Quote [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 249 | } 250 | // broken parser? 251 | throw new Error('CSVDataError: Illegal Data [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 252 | default: 253 | // shenanigans 254 | throw new Error('CSVDataError: Unknown State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 255 | } 256 | //console.log('val:' + m0 + ' state:' + state); 257 | }); 258 | 259 | // submit the last entry 260 | // ignore null last line 261 | if(entry.length !== 0) { 262 | endOfValue(); 263 | endOfEntry(); 264 | } 265 | 266 | return data; 267 | }, 268 | 269 | // a csv-specific line splitter 270 | splitLines: function(csv, options) { 271 | // cache settings 272 | var separator = options.separator; 273 | var delimiter = options.delimiter; 274 | 275 | // set initial state if it's missing 276 | if(!options.state.rowNum) { 277 | options.state.rowNum = 1; 278 | } 279 | 280 | // clear initial state 281 | var entries = []; 282 | var state = 0; 283 | var entry = ''; 284 | var exit = false; 285 | 286 | function endOfLine() { 287 | // reset the state 288 | state = 0; 289 | 290 | // if 'start' hasn't been met, don't output 291 | if(options.start && options.state.rowNum < options.start) { 292 | // update global state 293 | entry = ''; 294 | options.state.rowNum++; 295 | return; 296 | } 297 | 298 | if(options.onParseEntry === undefined) { 299 | // onParseEntry hook not set 300 | entries.push(entry); 301 | } else { 302 | var hookVal = options.onParseEntry(entry, options.state); // onParseEntry Hook 303 | // false skips the row, configurable through a hook 304 | if(hookVal !== false) { 305 | entries.push(hookVal); 306 | } 307 | } 308 | 309 | // cleanup 310 | entry = ''; 311 | 312 | // if 'end' is met, stop parsing 313 | if(options.end && options.state.rowNum >= options.end) { 314 | exit = true; 315 | } 316 | 317 | // update global state 318 | options.state.rowNum++; 319 | } 320 | 321 | // escape regex-specific control chars 322 | var escSeparator = RegExp.escape(separator); 323 | var escDelimiter = RegExp.escape(delimiter); 324 | 325 | // compile the regEx str using the custom delimiter/separator 326 | var match = /(D|S|\n|\r|[^DS\r\n]+)/; 327 | var matchSrc = match.source; 328 | matchSrc = matchSrc.replace(/S/g, escSeparator); 329 | matchSrc = matchSrc.replace(/D/g, escDelimiter); 330 | match = new RegExp(matchSrc, 'gm'); 331 | 332 | // put on your fancy pants... 333 | // process control chars individually, use look-ahead on non-control chars 334 | csv.replace(match, function (m0) { 335 | if(exit) { 336 | return; 337 | } 338 | switch (state) { 339 | // the start of a value/entry 340 | case 0: 341 | // null value 342 | if (m0 === separator) { 343 | entry += m0; 344 | state = 0; 345 | break; 346 | } 347 | // opening delimiter 348 | if (m0 === delimiter) { 349 | entry += m0; 350 | state = 1; 351 | break; 352 | } 353 | // end of line 354 | if (m0 === '\n') { 355 | endOfLine(); 356 | break; 357 | } 358 | // phantom carriage return 359 | if (/^\r$/.test(m0)) { 360 | break; 361 | } 362 | // un-delimit value 363 | entry += m0; 364 | state = 3; 365 | break; 366 | 367 | // delimited input 368 | case 1: 369 | // second delimiter? check further 370 | if (m0 === delimiter) { 371 | entry += m0; 372 | state = 2; 373 | break; 374 | } 375 | // delimited data 376 | entry += m0; 377 | state = 1; 378 | break; 379 | 380 | // delimiter found in delimited input 381 | case 2: 382 | // escaped delimiter? 383 | var prevChar = entry.substr(entry.length - 1); 384 | if (m0 === delimiter && prevChar === delimiter) { 385 | entry += m0; 386 | state = 1; 387 | break; 388 | } 389 | // end of value 390 | if (m0 === separator) { 391 | entry += m0; 392 | state = 0; 393 | break; 394 | } 395 | // end of line 396 | if (m0 === '\n') { 397 | endOfLine(); 398 | break; 399 | } 400 | // phantom carriage return 401 | if (m0 === '\r') { 402 | break; 403 | } 404 | // broken paser? 405 | throw new Error('CSVDataError: Illegal state [Row:' + options.state.rowNum + ']'); 406 | 407 | // un-delimited input 408 | case 3: 409 | // null value 410 | if (m0 === separator) { 411 | entry += m0; 412 | state = 0; 413 | break; 414 | } 415 | // end of line 416 | if (m0 === '\n') { 417 | endOfLine(); 418 | break; 419 | } 420 | // phantom carriage return 421 | if (m0 === '\r') { 422 | break; 423 | } 424 | // non-compliant data 425 | if (m0 === delimiter) { 426 | throw new Error('CSVDataError: Illegal quote [Row:' + options.state.rowNum + ']'); 427 | } 428 | // broken parser? 429 | throw new Error('CSVDataError: Illegal state [Row:' + options.state.rowNum + ']'); 430 | default: 431 | // shenanigans 432 | throw new Error('CSVDataError: Unknown state [Row:' + options.state.rowNum + ']'); 433 | } 434 | //console.log('val:' + m0 + ' state:' + state); 435 | }); 436 | 437 | // submit the last entry 438 | // ignore null last line 439 | if(entry !== '') { 440 | endOfLine(); 441 | } 442 | 443 | return entries; 444 | }, 445 | 446 | // a csv entry parser 447 | parseEntry: function(csv, options) { 448 | // cache settings 449 | var separator = options.separator; 450 | var delimiter = options.delimiter; 451 | 452 | // set initial state if it's missing 453 | if(!options.state.rowNum) { 454 | options.state.rowNum = 1; 455 | } 456 | if(!options.state.colNum) { 457 | options.state.colNum = 1; 458 | } 459 | 460 | // clear initial state 461 | var entry = []; 462 | var state = 0; 463 | var value = ''; 464 | 465 | function endOfValue() { 466 | if(options.onParseValue === undefined) { 467 | // onParseValue hook not set 468 | entry.push(value); 469 | } else { 470 | var hook = options.onParseValue(value, options.state); // onParseValue Hook 471 | // false skips the value, configurable through a hook 472 | if(hook !== false) { 473 | entry.push(hook); 474 | } 475 | } 476 | // reset the state 477 | value = ''; 478 | state = 0; 479 | // update global state 480 | options.state.colNum++; 481 | } 482 | 483 | // checked for a cached regEx first 484 | if(!options.match) { 485 | // escape regex-specific control chars 486 | var escSeparator = RegExp.escape(separator); 487 | var escDelimiter = RegExp.escape(delimiter); 488 | 489 | // compile the regEx str using the custom delimiter/separator 490 | var match = /(D|S|\n|\r|[^DS\r\n]+)/; 491 | var matchSrc = match.source; 492 | matchSrc = matchSrc.replace(/S/g, escSeparator); 493 | matchSrc = matchSrc.replace(/D/g, escDelimiter); 494 | options.match = new RegExp(matchSrc, 'gm'); 495 | } 496 | 497 | // put on your fancy pants... 498 | // process control chars individually, use look-ahead on non-control chars 499 | csv.replace(options.match, function (m0) { 500 | switch (state) { 501 | // the start of a value 502 | case 0: 503 | // null last value 504 | if (m0 === separator) { 505 | value += ''; 506 | endOfValue(); 507 | break; 508 | } 509 | // opening delimiter 510 | if (m0 === delimiter) { 511 | state = 1; 512 | break; 513 | } 514 | // skip un-delimited new-lines 515 | if (m0 === '\n' || m0 === '\r') { 516 | break; 517 | } 518 | // un-delimited value 519 | value += m0; 520 | state = 3; 521 | break; 522 | 523 | // delimited input 524 | case 1: 525 | // second delimiter? check further 526 | if (m0 === delimiter) { 527 | state = 2; 528 | break; 529 | } 530 | // delimited data 531 | value += m0; 532 | state = 1; 533 | break; 534 | 535 | // delimiter found in delimited input 536 | case 2: 537 | // escaped delimiter? 538 | if (m0 === delimiter) { 539 | value += m0; 540 | state = 1; 541 | break; 542 | } 543 | // null value 544 | if (m0 === separator) { 545 | endOfValue(); 546 | break; 547 | } 548 | // skip un-delimited new-lines 549 | if (m0 === '\n' || m0 === '\r') { 550 | break; 551 | } 552 | // broken paser? 553 | throw new Error('CSVDataError: Illegal State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 554 | 555 | // un-delimited input 556 | case 3: 557 | // null last value 558 | if (m0 === separator) { 559 | endOfValue(); 560 | break; 561 | } 562 | // skip un-delimited new-lines 563 | if (m0 === '\n' || m0 === '\r') { 564 | break; 565 | } 566 | // non-compliant data 567 | if (m0 === delimiter) { 568 | throw new Error('CSVDataError: Illegal Quote [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 569 | } 570 | // broken parser? 571 | throw new Error('CSVDataError: Illegal Data [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 572 | default: 573 | // shenanigans 574 | throw new Error('CSVDataError: Unknown State [Row:' + options.state.rowNum + '][Col:' + options.state.colNum + ']'); 575 | } 576 | //console.log('val:' + m0 + ' state:' + state); 577 | }); 578 | 579 | // submit the last value 580 | endOfValue(); 581 | 582 | return entry; 583 | } 584 | }, 585 | 586 | helpers: { 587 | 588 | /** 589 | * $.csv.helpers.collectPropertyNames(objectsArray) 590 | * Collects all unique property names from all passed objects. 591 | * 592 | * @param {Array} objects Objects to collect properties from. 593 | * 594 | * Returns an array of property names (array will be empty, 595 | * if objects have no own properties). 596 | */ 597 | collectPropertyNames: function (objects) { 598 | 599 | var o, propName, props = []; 600 | for (o in objects) { 601 | for (propName in objects[o]) { 602 | if ((objects[o].hasOwnProperty(propName)) && 603 | (props.indexOf(propName) < 0) && 604 | (typeof objects[o][propName] !== 'function')) { 605 | 606 | props.push(propName); 607 | } 608 | } 609 | } 610 | return props; 611 | } 612 | }, 613 | 614 | /** 615 | * $.csv.toArray(csv) 616 | * Converts a CSV entry string to a javascript array. 617 | * 618 | * @param {Array} csv The string containing the CSV data. 619 | * @param {Object} [options] An object containing user-defined options. 620 | * @param {Character} [separator] An override for the separator character. Defaults to a comma(,). 621 | * @param {Character} [delimiter] An override for the delimiter character. Defaults to a double-quote("). 622 | * 623 | * This method deals with simple CSV strings only. It's useful if you only 624 | * need to parse a single entry. If you need to parse more than one line, 625 | * use $.csv2Array instead. 626 | */ 627 | toArray: function(csv, options, callback) { 628 | options = (options !== undefined ? options : {}); 629 | var config = {}; 630 | config.callback = ((callback !== undefined && typeof(callback) === 'function') ? callback : false); 631 | config.separator = 'separator' in options ? options.separator : $.csv.defaults.separator; 632 | config.delimiter = 'delimiter' in options ? options.delimiter : $.csv.defaults.delimiter; 633 | var state = (options.state !== undefined ? options.state : {}); 634 | 635 | // setup 636 | options = { 637 | delimiter: config.delimiter, 638 | separator: config.separator, 639 | onParseEntry: options.onParseEntry, 640 | onParseValue: options.onParseValue, 641 | state: state 642 | }; 643 | 644 | var entry = $.csv.parsers.parseEntry(csv, options); 645 | 646 | // push the value to a callback if one is defined 647 | if(!config.callback) { 648 | return entry; 649 | } else { 650 | config.callback('', entry); 651 | } 652 | }, 653 | 654 | /** 655 | * $.csv.toArrays(csv) 656 | * Converts a CSV string to a javascript array. 657 | * 658 | * @param {String} csv The string containing the raw CSV data. 659 | * @param {Object} [options] An object containing user-defined options. 660 | * @param {Character} [separator] An override for the separator character. Defaults to a comma(,). 661 | * @param {Character} [delimiter] An override for the delimiter character. Defaults to a double-quote("). 662 | * 663 | * This method deals with multi-line CSV. The breakdown is simple. The first 664 | * dimension of the array represents the line (or entry/row) while the second 665 | * dimension contains the values (or values/columns). 666 | */ 667 | toArrays: function(csv, options, callback) { 668 | options = (options !== undefined ? options : {}); 669 | var config = {}; 670 | config.callback = ((callback !== undefined && typeof(callback) === 'function') ? callback : false); 671 | config.separator = 'separator' in options ? options.separator : $.csv.defaults.separator; 672 | config.delimiter = 'delimiter' in options ? options.delimiter : $.csv.defaults.delimiter; 673 | 674 | // setup 675 | var data = []; 676 | options = { 677 | delimiter: config.delimiter, 678 | separator: config.separator, 679 | onPreParse: options.onPreParse, 680 | onParseEntry: options.onParseEntry, 681 | onParseValue: options.onParseValue, 682 | onPostParse: options.onPostParse, 683 | start: options.start, 684 | end: options.end, 685 | state: { 686 | rowNum: 1, 687 | colNum: 1 688 | } 689 | }; 690 | 691 | // onPreParse hook 692 | if(options.onPreParse !== undefined) { 693 | options.onPreParse(csv, options.state); 694 | } 695 | 696 | // parse the data 697 | data = $.csv.parsers.parse(csv, options); 698 | 699 | // onPostParse hook 700 | if(options.onPostParse !== undefined) { 701 | options.onPostParse(data, options.state); 702 | } 703 | 704 | // push the value to a callback if one is defined 705 | if(!config.callback) { 706 | return data; 707 | } else { 708 | config.callback('', data); 709 | } 710 | }, 711 | 712 | /** 713 | * $.csv.toObjects(csv) 714 | * Converts a CSV string to a javascript object. 715 | * @param {String} csv The string containing the raw CSV data. 716 | * @param {Object} [options] An object containing user-defined options. 717 | * @param {Character} [separator] An override for the separator character. Defaults to a comma(,). 718 | * @param {Character} [delimiter] An override for the delimiter character. Defaults to a double-quote("). 719 | * @param {Boolean} [headers] Indicates whether the data contains a header line. Defaults to true. 720 | * 721 | * This method deals with multi-line CSV strings. Where the headers line is 722 | * used as the key for each value per entry. 723 | */ 724 | toObjects: function(csv, options, callback) { 725 | options = (options !== undefined ? options : {}); 726 | var config = {}; 727 | config.callback = ((callback !== undefined && typeof(callback) === 'function') ? callback : false); 728 | config.separator = 'separator' in options ? options.separator : $.csv.defaults.separator; 729 | config.delimiter = 'delimiter' in options ? options.delimiter : $.csv.defaults.delimiter; 730 | config.headers = 'headers' in options ? options.headers : $.csv.defaults.headers; 731 | options.start = 'start' in options ? options.start : 1; 732 | 733 | // account for headers 734 | if(config.headers) { 735 | options.start++; 736 | } 737 | if(options.end && config.headers) { 738 | options.end++; 739 | } 740 | 741 | // setup 742 | var lines = []; 743 | var data = []; 744 | 745 | options = { 746 | delimiter: config.delimiter, 747 | separator: config.separator, 748 | onPreParse: options.onPreParse, 749 | onParseEntry: options.onParseEntry, 750 | onParseValue: options.onParseValue, 751 | onPostParse: options.onPostParse, 752 | start: options.start, 753 | end: options.end, 754 | state: { 755 | rowNum: 1, 756 | colNum: 1 757 | }, 758 | match: false, 759 | transform: options.transform 760 | }; 761 | 762 | // fetch the headers 763 | var headerOptions = { 764 | delimiter: config.delimiter, 765 | separator: config.separator, 766 | start: 1, 767 | end: 1, 768 | state: { 769 | rowNum:1, 770 | colNum:1 771 | } 772 | }; 773 | 774 | // onPreParse hook 775 | if(options.onPreParse !== undefined) { 776 | options.onPreParse(csv, options.state); 777 | } 778 | 779 | // parse the csv 780 | var headerLine = $.csv.parsers.splitLines(csv, headerOptions); 781 | var headers = $.csv.toArray(headerLine[0], options); 782 | 783 | // fetch the data 784 | lines = $.csv.parsers.splitLines(csv, options); 785 | 786 | // reset the state for re-use 787 | options.state.colNum = 1; 788 | if(headers){ 789 | options.state.rowNum = 2; 790 | } else { 791 | options.state.rowNum = 1; 792 | } 793 | 794 | // convert data to objects 795 | for(var i=0, len=lines.length; i -1) { 853 | strValue = strValue.replace(config.delimiter, config.delimiter + config.delimiter); 854 | } 855 | 856 | var escMatcher = '\n|\r|S|D'; 857 | escMatcher = escMatcher.replace('S', config.separator); 858 | escMatcher = escMatcher.replace('D', config.delimiter); 859 | 860 | if (strValue.search(escMatcher) > -1) { 861 | strValue = config.delimiter + strValue + config.delimiter; 862 | } 863 | lineValues.push(strValue); 864 | } 865 | output += lineValues.join(config.separator) + '\r\n'; 866 | } 867 | 868 | // push the value to a callback if one is defined 869 | if(!config.callback) { 870 | return output; 871 | } else { 872 | config.callback('', output); 873 | } 874 | }, 875 | 876 | /** 877 | * $.csv.fromObjects(objects) 878 | * Converts a javascript dictionary to a CSV string. 879 | * 880 | * @param {Object} objects An array of objects containing the data. 881 | * @param {Object} [options] An object containing user-defined options. 882 | * @param {Character} [separator] An override for the separator character. Defaults to a comma(,). 883 | * @param {Character} [delimiter] An override for the delimiter character. Defaults to a double-quote("). 884 | * @param {Character} [sortOrder] Sort order of columns (named after 885 | * object properties). Use 'alpha' for alphabetic. Default is 'declare', 886 | * which means, that properties will _probably_ appear in order they were 887 | * declared for the object. But without any guarantee. 888 | * @param {Character or Array} [manualOrder] Manually order columns. May be 889 | * a strin in a same csv format as an output or an array of header names 890 | * (array items won't be parsed). All the properties, not present in 891 | * `manualOrder` will be appended to the end in accordance with `sortOrder` 892 | * option. So the `manualOrder` always takes preference, if present. 893 | * 894 | * This method generates a CSV file from an array of objects (name:value pairs). 895 | * It starts by detecting the headers and adding them as the first line of 896 | * the CSV file, followed by a structured dump of the data. 897 | */ 898 | fromObjects: function(objects, options, callback) { 899 | options = (options !== undefined ? options : {}); 900 | var config = {}; 901 | config.callback = ((callback !== undefined && typeof(callback) === 'function') ? callback : false); 902 | config.separator = 'separator' in options ? options.separator : $.csv.defaults.separator; 903 | config.delimiter = 'delimiter' in options ? options.delimiter : $.csv.defaults.delimiter; 904 | config.headers = 'headers' in options ? options.headers : $.csv.defaults.headers; 905 | config.sortOrder = 'sortOrder' in options ? options.sortOrder : 'declare'; 906 | config.manualOrder = 'manualOrder' in options ? options.manualOrder : []; 907 | config.transform = options.transform; 908 | 909 | if (typeof config.manualOrder === 'string') { 910 | config.manualOrder = $.csv.toArray(config.manualOrder, config); 911 | } 912 | 913 | if (config.transform !== undefined) { 914 | var origObjects = objects; 915 | objects = []; 916 | 917 | var i; 918 | for (i = 0; i < origObjects.length; i++) { 919 | objects.push(config.transform.call(undefined, origObjects[i])); 920 | } 921 | } 922 | 923 | var props = $.csv.helpers.collectPropertyNames(objects); 924 | 925 | if (config.sortOrder === 'alpha') { 926 | props.sort(); 927 | } // else {} - nothing to do for 'declare' order 928 | 929 | if (config.manualOrder.length > 0) { 930 | 931 | var propsManual = [].concat(config.manualOrder); 932 | var p; 933 | for (p = 0; p < props.length; p++) { 934 | if (propsManual.indexOf( props[p] ) < 0) { 935 | propsManual.push( props[p] ); 936 | } 937 | } 938 | props = propsManual; 939 | } 940 | 941 | var o, p, line, output = [], propName; 942 | if (config.headers) { 943 | output.push(props); 944 | } 945 | 946 | for (o = 0; o < objects.length; o++) { 947 | line = []; 948 | for (p = 0; p < props.length; p++) { 949 | propName = props[p]; 950 | if (propName in objects[o] && typeof objects[o][propName] !== 'function') { 951 | line.push(objects[o][propName]); 952 | } else { 953 | line.push(''); 954 | } 955 | } 956 | output.push(line); 957 | } 958 | 959 | // push the value to a callback if one is defined 960 | return $.csv.fromArrays(output, options, config.callback); 961 | } 962 | }; 963 | 964 | // Maintenance code to maintain backward-compatibility 965 | // Will be removed in release 1.0 966 | $.csvEntry2Array = $.csv.toArray; 967 | $.csv2Array = $.csv.toArrays; 968 | $.csv2Dictionary = $.csv.toObjects; 969 | 970 | // CommonJS module is defined 971 | if (typeof module !== 'undefined' && module.exports) { 972 | module.exports = $.csv; 973 | } 974 | 975 | }).call( this ); 976 | -------------------------------------------------------------------------------- /examples/sample.csv: -------------------------------------------------------------------------------- 1 | -28.700225, 28.602905, 2 | -28.700225, 28.602905, ZAF 3 | -28.433676, 19.986191, ZAF 4 | -28.433676, 19.986191, 5 | -28.433676, 19.986191, NAM 6 | 13.661115, 144.560790000, 7 | -20.529975, 57.356025000, 8 | 52.383984, 4.865401375, 9 | 26.904854, 95.138497, 10 | -28.433676, 19.986191, 11 | -28.433676, 19.986191, 12 | 13.661115, 144.560790000, ZAF 13 | -20.529975, 57.356025000, ZAF 14 | 52.383984, 4.865401375, ZAF 15 | 26.904854, 95.138497, ZAF 16 | -------------------------------------------------------------------------------- /mapcode_library_js.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mapcode-foundation/mapcode-js/25abcc53f4a15b996810a9d0fd00ff2efd0f2eeb/mapcode_library_js.doc -------------------------------------------------------------------------------- /sample.html: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 |

Sample mapcode HTML

30 | 31 | 58 | 59 |
60 | 61 |
62 | Mapcode: 63 | 64 | Territory context: 65 | 66 | 67 |
68 | 69 |
Enter a territory and enter a mapcode:
70 | 71 |
72 |
73 | 74 | 111 | 112 |
113 | 114 |
115 | Latitude: 116 | 117 | Longitude: 118 | 119 | Restrict to territory:: 120 | 121 | 122 |
123 | 124 |
Enter a latitude, a longitude, and a default territory context:
125 | 126 |
127 | 128 | 129 | -------------------------------------------------------------------------------- /unittest/test_territories.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2003-2018 Stichting Mapcode Foundation (http://www.mapcode.com) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | function test_territories() { 18 | test_territory("AAA", 533, 0, 0, 0); 19 | test_territory("AB", 396, 0, 0, 496); 20 | test_territory("ABW", 26, 0, 0, 0); 21 | test_territory("AC", 328, 0, 0, 410); 22 | test_territory("ACT", 309, 0, 0, 409); 23 | test_territory("AD", 417, 0, 0, 497); 24 | test_territory("AFG", 207, 0, 0, 0); 25 | test_territory("AG", 237, 1, 0, 412); 26 | test_territory("AGO", 225, 0, 0, 0); 27 | test_territory("AGU", 237, 0, 0, 412); 28 | test_territory("AH", 507, 0, 0, 529); 29 | test_territory("AIA", 19, 0, 0, 0); 30 | test_territory("AK", 394, 0, 0, 411); 31 | test_territory("AL", 483, 0, 1, 497); 32 | test_territory("AL", 365, 0, 1, 411); 33 | test_territory("AL", 319, 0, 1, 410); 34 | test_territory("ALA", 199, 0, 0, 0); 35 | test_territory("ALB", 103, 0, 0, 0); 36 | test_territory("ALT", 484, 0, 0, 497); 37 | test_territory("AM", 343, 0, 0, 410); 38 | test_territory("AMU", 494, 0, 0, 497); 39 | test_territory("AN", 275, 0, 0, 408); 40 | test_territory("AND", 50, 0, 0, 0); 41 | test_territory("AP", 326, 0, 1, 410); 42 | test_territory("AP", 304, 0, 1, 408); 43 | test_territory("AR", 366, 0, 1, 411); 44 | test_territory("AR", 286, 0, 1, 408); 45 | test_territory("ARE", 131, 0, 0, 0); 46 | test_territory("ARG", 271, 0, 0, 0); 47 | test_territory("ARK", 455, 0, 0, 497); 48 | test_territory("ARM", 105, 0, 0, 0); 49 | test_territory("AS", 287, 0, 1, 408); 50 | test_territory("AS", 28, 1, 1, 411); 51 | test_territory("ASC", 36, 1, 0, 0); 52 | test_territory("ASM", 28, 0, 0, 0); 53 | test_territory("AST", 435, 0, 0, 497); 54 | test_territory("ATA", 532, 0, 0, 0); 55 | test_territory("ATF", 76, 0, 0, 0); 56 | test_territory("ATG", 45, 0, 0, 0); 57 | test_territory("AU", 409, 1, 0, 0); 58 | test_territory("AU-ACT", 309, 0, 0, 409); 59 | test_territory("AU-CC", 5, 1, 0, 409); 60 | test_territory("AU-CX", 22, 1, 0, 409); 61 | test_territory("AU-HM", 43, 1, 0, 409); 62 | test_territory("AU-JBT", 310, 0, 0, 409); 63 | test_territory("AU-NF", 12, 1, 0, 409); 64 | test_territory("AU-NSW", 308, 0, 0, 409); 65 | test_territory("AU-NT", 311, 0, 0, 409); 66 | test_territory("AU-QLD", 316, 0, 0, 409); 67 | test_territory("AU-SA", 312, 0, 0, 409); 68 | test_territory("AU-TAS", 313, 0, 0, 409); 69 | test_territory("AU-VIC", 314, 0, 0, 409); 70 | test_territory("AU-WA", 315, 0, 0, 409); 71 | test_territory("AUS", 409, 0, 0, 0); 72 | test_territory("AUS-ACT", 309, 0, 0, 409); 73 | test_territory("AUS-CC", 5, 1, 0, 409); 74 | test_territory("AUS-CX", 22, 1, 0, 409); 75 | test_territory("AUS-HM", 43, 1, 0, 409); 76 | test_territory("AUS-JBT", 310, 0, 0, 409); 77 | test_territory("AUS-NF", 12, 1, 0, 409); 78 | test_territory("AUS-NSW", 308, 0, 0, 409); 79 | test_territory("AUS-NT", 311, 0, 0, 409); 80 | test_territory("AUS-QLD", 316, 0, 0, 409); 81 | test_territory("AUS-SA", 312, 0, 0, 409); 82 | test_territory("AUS-TAS", 313, 0, 0, 409); 83 | test_territory("AUS-VIC", 314, 0, 0, 409); 84 | test_territory("AUS-WA", 315, 0, 0, 409); 85 | test_territory("AUT", 132, 0, 0, 0); 86 | test_territory("AZ", 389, 0, 0, 411); 87 | test_territory("AZE", 133, 0, 0, 0); 88 | test_territory("BA", 464, 0, 1, 497); 89 | test_territory("BA", 339, 0, 1, 410); 90 | test_territory("BC", 395, 0, 1, 496); 91 | test_territory("BC", 254, 1, 1, 412); 92 | test_territory("BCN", 254, 0, 0, 412); 93 | test_territory("BCS", 257, 0, 0, 412); 94 | test_territory("BDI", 101, 0, 0, 0); 95 | test_territory("BE", 427, 0, 0, 497); 96 | test_territory("BEL", 107, 0, 0, 0); 97 | test_territory("BEN", 145, 0, 0, 0); 98 | test_territory("BES", 34, 0, 0, 0); 99 | test_territory("BFA", 173, 0, 0, 0); 100 | test_territory("BGD", 152, 0, 0, 0); 101 | test_territory("BGR", 142, 0, 0, 0); 102 | test_territory("BHR", 58, 0, 0, 0); 103 | test_territory("BHS", 86, 0, 0, 0); 104 | test_territory("BIH", 119, 0, 0, 0); 105 | test_territory("BJ", 500, 0, 0, 529); 106 | test_territory("BLM", 6, 0, 0, 0); 107 | test_territory("BLR", 161, 0, 0, 0); 108 | test_territory("BLZ", 96, 0, 0, 0); 109 | test_territory("BMU", 15, 0, 0, 0); 110 | test_territory("BOL", 220, 0, 0, 0); 111 | test_territory("BR", 288, 0, 0, 408); 112 | test_territory("BR-AC", 328, 0, 0, 410); 113 | test_territory("BR-AL", 319, 0, 0, 410); 114 | test_territory("BR-AM", 343, 0, 0, 410); 115 | test_territory("BR-AP", 326, 0, 0, 410); 116 | test_territory("BR-BA", 339, 0, 0, 410); 117 | test_territory("BR-CE", 327, 0, 0, 410); 118 | test_territory("BR-DF", 317, 0, 0, 410); 119 | test_territory("BR-ES", 321, 0, 0, 410); 120 | test_territory("BR-GO", 337, 0, 0, 410); 121 | test_territory("BR-MA", 336, 0, 0, 410); 122 | test_territory("BR-MG", 340, 0, 0, 410); 123 | test_territory("BR-MS", 338, 0, 0, 410); 124 | test_territory("BR-MT", 341, 0, 0, 410); 125 | test_territory("BR-PA", 342, 0, 0, 410); 126 | test_territory("BR-PB", 323, 0, 0, 410); 127 | test_territory("BR-PE", 325, 0, 0, 410); 128 | test_territory("BR-PI", 333, 0, 0, 410); 129 | test_territory("BR-PR", 329, 0, 0, 410); 130 | test_territory("BR-RJ", 320, 0, 0, 410); 131 | test_territory("BR-RN", 322, 0, 0, 410); 132 | test_territory("BR-RO", 331, 0, 0, 410); 133 | test_territory("BR-RR", 330, 0, 0, 410); 134 | test_territory("BR-RS", 335, 0, 0, 410); 135 | test_territory("BR-SC", 324, 0, 0, 410); 136 | test_territory("BR-SE", 318, 0, 0, 410); 137 | test_territory("BR-SP", 332, 0, 0, 410); 138 | test_territory("BR-TO", 334, 0, 0, 410); 139 | test_territory("BRA", 410, 0, 0, 0); 140 | test_territory("BRA-AC", 328, 0, 0, 410); 141 | test_territory("BRA-AL", 319, 0, 0, 410); 142 | test_territory("BRA-AM", 343, 0, 0, 410); 143 | test_territory("BRA-AP", 326, 0, 0, 410); 144 | test_territory("BRA-BA", 339, 0, 0, 410); 145 | test_territory("BRA-CE", 327, 0, 0, 410); 146 | test_territory("BRA-DF", 317, 0, 0, 410); 147 | test_territory("BRA-ES", 321, 0, 0, 410); 148 | test_territory("BRA-GO", 337, 0, 0, 410); 149 | test_territory("BRA-MA", 336, 0, 0, 410); 150 | test_territory("BRA-MG", 340, 0, 0, 410); 151 | test_territory("BRA-MS", 338, 0, 0, 410); 152 | test_territory("BRA-MT", 341, 0, 0, 410); 153 | test_territory("BRA-PA", 342, 0, 0, 410); 154 | test_territory("BRA-PB", 323, 0, 0, 410); 155 | test_territory("BRA-PE", 325, 0, 0, 410); 156 | test_territory("BRA-PI", 333, 0, 0, 410); 157 | test_territory("BRA-PR", 329, 0, 0, 410); 158 | test_territory("BRA-RJ", 320, 0, 0, 410); 159 | test_territory("BRA-RN", 322, 0, 0, 410); 160 | test_territory("BRA-RO", 331, 0, 0, 410); 161 | test_territory("BRA-RR", 330, 0, 0, 410); 162 | test_territory("BRA-RS", 335, 0, 0, 410); 163 | test_territory("BRA-SC", 324, 0, 0, 410); 164 | test_territory("BRA-SE", 318, 0, 0, 410); 165 | test_territory("BRA-SP", 332, 0, 0, 410); 166 | test_territory("BRA-TO", 334, 0, 0, 410); 167 | test_territory("BRB", 44, 0, 0, 0); 168 | test_territory("BRN", 75, 0, 0, 0); 169 | test_territory("BRY", 432, 0, 0, 497); 170 | test_territory("BS", 257, 1, 0, 412); 171 | test_territory("BTN", 111, 0, 0, 0); 172 | test_territory("BU", 475, 0, 0, 497); 173 | test_territory("BVT", 14, 0, 0, 0); 174 | test_territory("BWA", 201, 0, 0, 0); 175 | test_territory("CA", 392, 0, 0, 411); 176 | test_territory("CA-AB", 396, 0, 0, 496); 177 | test_territory("CA-BC", 395, 0, 0, 496); 178 | test_territory("CA-MB", 400, 0, 0, 496); 179 | test_territory("CA-NB", 402, 0, 0, 496); 180 | test_territory("CA-NL", 401, 0, 0, 496); 181 | test_territory("CA-NS", 403, 0, 0, 496); 182 | test_territory("CA-NT", 406, 0, 0, 496); 183 | test_territory("CA-NU", 407, 0, 0, 496); 184 | test_territory("CA-ON", 397, 0, 0, 496); 185 | test_territory("CA-PE", 404, 0, 0, 496); 186 | test_territory("CA-QC", 398, 0, 0, 496); 187 | test_territory("CA-SK", 399, 0, 0, 496); 188 | test_territory("CA-YT", 405, 0, 0, 496); 189 | test_territory("CAF", 205, 0, 0, 0); 190 | test_territory("CAM", 249, 0, 0, 412); 191 | test_territory("CAN", 496, 0, 0, 0); 192 | test_territory("CAN-AB", 396, 0, 0, 496); 193 | test_territory("CAN-BC", 395, 0, 0, 496); 194 | test_territory("CAN-MB", 400, 0, 0, 496); 195 | test_territory("CAN-NB", 402, 0, 0, 496); 196 | test_territory("CAN-NL", 401, 0, 0, 496); 197 | test_territory("CAN-NS", 403, 0, 0, 496); 198 | test_territory("CAN-NT", 406, 0, 0, 496); 199 | test_territory("CAN-NU", 407, 0, 0, 496); 200 | test_territory("CAN-ON", 397, 0, 0, 496); 201 | test_territory("CAN-PE", 404, 0, 0, 496); 202 | test_territory("CAN-QC", 398, 0, 0, 496); 203 | test_territory("CAN-SK", 399, 0, 0, 496); 204 | test_territory("CAN-YT", 405, 0, 0, 496); 205 | test_territory("CC", 5, 1, 0, 409); 206 | test_territory("CCK", 5, 0, 0, 0); 207 | test_territory("CE", 421, 0, 1, 497); 208 | test_territory("CE", 327, 0, 1, 410); 209 | test_territory("CG", 295, 1, 0, 408); 210 | test_territory("CH", 474, 0, 1, 497); 211 | test_territory("CH", 274, 0, 1, 408); 212 | test_territory("CH", 265, 1, 1, 412); 213 | test_territory("CHE", 112, 0, 0, 0); 214 | test_territory("CHH", 265, 0, 0, 412); 215 | test_territory("CHL", 210, 0, 0, 0); 216 | test_territory("CHN", 529, 0, 0, 0); 217 | test_territory("CHN-11", 500, 1, 0, 529); 218 | test_territory("CHN-12", 499, 1, 0, 529); 219 | test_territory("CHN-13", 517, 1, 0, 529); 220 | test_territory("CHN-14", 510, 1, 0, 529); 221 | test_territory("CHN-15", 519, 1, 0, 529); 222 | test_territory("CHN-21", 508, 1, 0, 529); 223 | test_territory("CHN-22", 516, 1, 0, 529); 224 | test_territory("CHN-23", 520, 1, 0, 529); 225 | test_territory("CHN-31", 498, 1, 0, 529); 226 | test_territory("CHN-32", 505, 1, 0, 529); 227 | test_territory("CHN-33", 504, 1, 0, 529); 228 | test_territory("CHN-34", 507, 1, 0, 529); 229 | test_territory("CHN-35", 506, 1, 0, 529); 230 | test_territory("CHN-36", 511, 1, 0, 529); 231 | test_territory("CHN-37", 509, 1, 0, 529); 232 | test_territory("CHN-41", 512, 1, 0, 529); 233 | test_territory("CHN-42", 515, 1, 0, 529); 234 | test_territory("CHN-43", 521, 1, 0, 529); 235 | test_territory("CHN-44", 514, 1, 0, 529); 236 | test_territory("CHN-45", 522, 1, 0, 529); 237 | test_territory("CHN-46", 501, 1, 0, 529); 238 | test_territory("CHN-50", 503, 1, 0, 529); 239 | test_territory("CHN-51", 523, 1, 0, 529); 240 | test_territory("CHN-52", 513, 1, 0, 529); 241 | test_territory("CHN-53", 524, 1, 0, 529); 242 | test_territory("CHN-54", 525, 1, 0, 529); 243 | test_territory("CHN-61", 518, 1, 0, 529); 244 | test_territory("CHN-62", 526, 1, 0, 529); 245 | test_territory("CHN-63", 527, 1, 0, 529); 246 | test_territory("CHN-64", 502, 1, 0, 529); 247 | test_territory("CHN-65", 528, 1, 0, 529); 248 | test_territory("CHN-71", 110, 1, 0, 529); 249 | test_territory("CHN-91", 62, 1, 0, 529); 250 | test_territory("CHN-92", 9, 1, 0, 529); 251 | test_territory("CHN-AH", 507, 0, 0, 529); 252 | test_territory("CHN-BJ", 500, 0, 0, 529); 253 | test_territory("CHN-CQ", 503, 0, 0, 529); 254 | test_territory("CHN-FJ", 506, 0, 0, 529); 255 | test_territory("CHN-GD", 514, 0, 0, 529); 256 | test_territory("CHN-GS", 526, 0, 0, 529); 257 | test_territory("CHN-GX", 522, 0, 0, 529); 258 | test_territory("CHN-GZ", 513, 0, 0, 529); 259 | test_territory("CHN-HA", 512, 0, 0, 529); 260 | test_territory("CHN-HB", 515, 0, 0, 529); 261 | test_territory("CHN-HE", 517, 0, 0, 529); 262 | test_territory("CHN-HI", 501, 0, 0, 529); 263 | test_territory("CHN-HK", 62, 1, 0, 529); 264 | test_territory("CHN-HL", 520, 0, 0, 529); 265 | test_territory("CHN-HN", 521, 0, 0, 529); 266 | test_territory("CHN-JL", 516, 0, 0, 529); 267 | test_territory("CHN-JS", 505, 0, 0, 529); 268 | test_territory("CHN-JX", 511, 0, 0, 529); 269 | test_territory("CHN-LN", 508, 0, 0, 529); 270 | test_territory("CHN-MC", 9, 1, 0, 529); 271 | test_territory("CHN-NM", 519, 0, 0, 529); 272 | test_territory("CHN-NX", 502, 0, 0, 529); 273 | test_territory("CHN-QH", 527, 0, 0, 529); 274 | test_territory("CHN-SC", 523, 0, 0, 529); 275 | test_territory("CHN-SD", 509, 0, 0, 529); 276 | test_territory("CHN-SH", 498, 0, 0, 529); 277 | test_territory("CHN-SN", 518, 0, 0, 529); 278 | test_territory("CHN-SX", 510, 0, 0, 529); 279 | test_territory("CHN-TJ", 499, 0, 0, 529); 280 | test_territory("CHN-TW", 110, 1, 0, 529); 281 | test_territory("CHN-XJ", 528, 0, 0, 529); 282 | test_territory("CHN-XZ", 525, 0, 0, 529); 283 | test_territory("CHN-YN", 524, 0, 0, 529); 284 | test_territory("CHN-ZJ", 504, 0, 0, 529); 285 | test_territory("CHP", 256, 0, 0, 412); 286 | test_territory("CHU", 488, 0, 0, 497); 287 | test_territory("CIV", 178, 0, 0, 0); 288 | test_territory("CL", 238, 0, 0, 412); 289 | test_territory("CM", 249, 1, 0, 412); 290 | test_territory("CMR", 193, 0, 0, 0); 291 | test_territory("CN", 529, 1, 0, 0); 292 | test_territory("CN-11", 500, 1, 0, 529); 293 | test_territory("CN-12", 499, 1, 0, 529); 294 | test_territory("CN-13", 517, 1, 0, 529); 295 | test_territory("CN-14", 510, 1, 0, 529); 296 | test_territory("CN-15", 519, 1, 0, 529); 297 | test_territory("CN-21", 508, 1, 0, 529); 298 | test_territory("CN-22", 516, 1, 0, 529); 299 | test_territory("CN-23", 520, 1, 0, 529); 300 | test_territory("CN-31", 498, 1, 0, 529); 301 | test_territory("CN-32", 505, 1, 0, 529); 302 | test_territory("CN-33", 504, 1, 0, 529); 303 | test_territory("CN-34", 507, 1, 0, 529); 304 | test_territory("CN-35", 506, 1, 0, 529); 305 | test_territory("CN-36", 511, 1, 0, 529); 306 | test_territory("CN-37", 509, 1, 0, 529); 307 | test_territory("CN-41", 512, 1, 0, 529); 308 | test_territory("CN-42", 515, 1, 0, 529); 309 | test_territory("CN-43", 521, 1, 0, 529); 310 | test_territory("CN-44", 514, 1, 0, 529); 311 | test_territory("CN-45", 522, 1, 0, 529); 312 | test_territory("CN-46", 501, 1, 0, 529); 313 | test_territory("CN-50", 503, 1, 0, 529); 314 | test_territory("CN-51", 523, 1, 0, 529); 315 | test_territory("CN-52", 513, 1, 0, 529); 316 | test_territory("CN-53", 524, 1, 0, 529); 317 | test_territory("CN-54", 525, 1, 0, 529); 318 | test_territory("CN-61", 518, 1, 0, 529); 319 | test_territory("CN-62", 526, 1, 0, 529); 320 | test_territory("CN-63", 527, 1, 0, 529); 321 | test_territory("CN-64", 502, 1, 0, 529); 322 | test_territory("CN-65", 528, 1, 0, 529); 323 | test_territory("CN-71", 110, 1, 0, 529); 324 | test_territory("CN-91", 62, 1, 0, 529); 325 | test_territory("CN-92", 9, 1, 0, 529); 326 | test_territory("CN-AH", 507, 0, 0, 529); 327 | test_territory("CN-BJ", 500, 0, 0, 529); 328 | test_territory("CN-CQ", 503, 0, 0, 529); 329 | test_territory("CN-FJ", 506, 0, 0, 529); 330 | test_territory("CN-GD", 514, 0, 0, 529); 331 | test_territory("CN-GS", 526, 0, 0, 529); 332 | test_territory("CN-GX", 522, 0, 0, 529); 333 | test_territory("CN-GZ", 513, 0, 0, 529); 334 | test_territory("CN-HA", 512, 0, 0, 529); 335 | test_territory("CN-HB", 515, 0, 0, 529); 336 | test_territory("CN-HE", 517, 0, 0, 529); 337 | test_territory("CN-HI", 501, 0, 0, 529); 338 | test_territory("CN-HK", 62, 1, 0, 529); 339 | test_territory("CN-HL", 520, 0, 0, 529); 340 | test_territory("CN-HN", 521, 0, 0, 529); 341 | test_territory("CN-JL", 516, 0, 0, 529); 342 | test_territory("CN-JS", 505, 0, 0, 529); 343 | test_territory("CN-JX", 511, 0, 0, 529); 344 | test_territory("CN-LN", 508, 0, 0, 529); 345 | test_territory("CN-MC", 9, 1, 0, 529); 346 | test_territory("CN-NM", 519, 0, 0, 529); 347 | test_territory("CN-NX", 502, 0, 0, 529); 348 | test_territory("CN-QH", 527, 0, 0, 529); 349 | test_territory("CN-SC", 523, 0, 0, 529); 350 | test_territory("CN-SD", 509, 0, 0, 529); 351 | test_territory("CN-SH", 498, 0, 0, 529); 352 | test_territory("CN-SN", 518, 0, 0, 529); 353 | test_territory("CN-SX", 510, 0, 0, 529); 354 | test_territory("CN-TJ", 499, 0, 0, 529); 355 | test_territory("CN-TW", 110, 1, 0, 529); 356 | test_territory("CN-XJ", 528, 0, 0, 529); 357 | test_territory("CN-XZ", 525, 0, 0, 529); 358 | test_territory("CN-YN", 524, 0, 0, 529); 359 | test_territory("CN-ZJ", 504, 0, 0, 529); 360 | test_territory("CO", 387, 0, 1, 411); 361 | test_territory("CO", 263, 1, 1, 412); 362 | test_territory("COA", 263, 0, 0, 412); 363 | test_territory("COD", 268, 0, 0, 0); 364 | test_territory("COG", 183, 0, 0, 0); 365 | test_territory("COK", 29, 0, 0, 0); 366 | test_territory("COL", 222, 0, 0, 0); 367 | test_territory("COM", 66, 0, 0, 0); 368 | test_territory("CPT", 531, 0, 0, 0); 369 | test_territory("CPV", 73, 0, 0, 0); 370 | test_territory("CQ", 503, 0, 0, 529); 371 | test_territory("CRI", 118, 0, 0, 0); 372 | test_territory("CS", 256, 1, 0, 412); 373 | test_territory("CT", 347, 0, 1, 411); 374 | test_territory("CT", 295, 0, 1, 408); 375 | test_territory("CU", 422, 0, 0, 497); 376 | test_territory("CUB", 141, 0, 0, 0); 377 | test_territory("CUW", 46, 0, 0, 0); 378 | test_territory("CX", 22, 1, 0, 409); 379 | test_territory("CXR", 22, 0, 0, 0); 380 | test_territory("CYM", 33, 0, 0, 0); 381 | test_territory("CYP", 78, 0, 0, 0); 382 | test_territory("CZE", 129, 0, 0, 0); 383 | test_territory("DA", 438, 0, 0, 497); 384 | test_territory("DC", 344, 0, 0, 411); 385 | test_territory("DD", 272, 0, 0, 408); 386 | test_territory("DE", 346, 0, 0, 411); 387 | test_territory("DEU", 184, 0, 0, 0); 388 | test_territory("DF", 317, 0, 1, 410); 389 | test_territory("DF", 234, 1, 1, 412); 390 | test_territory("DG", 262, 1, 0, 412); 391 | test_territory("DGA", 16, 1, 0, 0); 392 | test_territory("DIF", 234, 0, 0, 412); 393 | test_territory("DJI", 97, 0, 0, 0); 394 | test_territory("DL", 277, 0, 0, 408); 395 | test_territory("DMA", 57, 0, 0, 0); 396 | test_territory("DN", 273, 0, 0, 408); 397 | test_territory("DNK", 114, 0, 0, 0); 398 | test_territory("DOM", 116, 0, 0, 0); 399 | test_territory("DUR", 262, 0, 0, 412); 400 | test_territory("DZA", 269, 0, 0, 0); 401 | test_territory("ECU", 169, 0, 0, 0); 402 | test_territory("EGY", 218, 0, 0, 0); 403 | test_territory("ERI", 146, 0, 0, 0); 404 | test_territory("ES", 321, 0, 0, 410); 405 | test_territory("ESH", 170, 0, 0, 0); 406 | test_territory("ESP", 195, 0, 0, 0); 407 | test_territory("EST", 115, 0, 0, 0); 408 | test_territory("ETH", 221, 0, 0, 0); 409 | test_territory("FIN", 182, 0, 0, 0); 410 | test_territory("FJ", 506, 0, 0, 529); 411 | test_territory("FJI", 90, 0, 0, 0); 412 | test_territory("FL", 373, 0, 0, 411); 413 | test_territory("FLK", 83, 0, 0, 0); 414 | test_territory("FRA", 198, 0, 0, 0); 415 | test_territory("FRO", 64, 0, 0, 0); 416 | test_territory("FSM", 54, 0, 0, 0); 417 | test_territory("GA", 371, 0, 1, 411); 418 | test_territory("GA", 290, 0, 1, 408); 419 | test_territory("GAB", 171, 0, 0, 0); 420 | test_territory("GBR", 167, 0, 0, 0); 421 | test_territory("GD", 514, 0, 0, 529); 422 | test_territory("GEO", 125, 0, 0, 0); 423 | test_territory("GGY", 18, 0, 0, 0); 424 | test_territory("GHA", 165, 0, 0, 0); 425 | test_territory("GIB", 3, 0, 0, 0); 426 | test_territory("GIN", 168, 0, 0, 0); 427 | test_territory("GJ", 300, 0, 0, 408); 428 | test_territory("GLP", 65, 0, 0, 0); 429 | test_territory("GMB", 81, 0, 0, 0); 430 | test_territory("GNB", 109, 0, 0, 0); 431 | test_territory("GNQ", 102, 0, 0, 0); 432 | test_territory("GO", 337, 0, 0, 410); 433 | test_territory("GR", 252, 1, 0, 412); 434 | test_territory("GRC", 150, 0, 0, 0); 435 | test_territory("GRD", 38, 0, 0, 0); 436 | test_territory("GRL", 266, 0, 0, 0); 437 | test_territory("GRO", 252, 0, 0, 412); 438 | test_territory("GS", 526, 0, 0, 529); 439 | test_territory("GT", 244, 1, 0, 412); 440 | test_territory("GTM", 140, 0, 0, 0); 441 | test_territory("GU", 51, 1, 0, 411); 442 | test_territory("GUA", 244, 0, 0, 412); 443 | test_territory("GUF", 130, 0, 0, 0); 444 | test_territory("GUM", 51, 0, 0, 0); 445 | test_territory("GUY", 162, 0, 0, 0); 446 | test_territory("GX", 522, 0, 0, 529); 447 | test_territory("GZ", 513, 0, 0, 529); 448 | test_territory("HA", 512, 0, 0, 529); 449 | test_territory("HB", 515, 0, 0, 529); 450 | test_territory("HE", 517, 0, 0, 529); 451 | test_territory("HG", 240, 1, 0, 412); 452 | test_territory("HI", 501, 0, 1, 529); 453 | test_territory("HI", 352, 0, 1, 411); 454 | test_territory("HID", 240, 0, 0, 412); 455 | test_territory("HK", 62, 1, 0, 529); 456 | test_territory("HKG", 62, 0, 0, 0); 457 | test_territory("HL", 520, 0, 0, 529); 458 | test_territory("HM", 43, 1, 0, 409); 459 | test_territory("HMD", 43, 0, 0, 0); 460 | test_territory("HN", 521, 0, 0, 529); 461 | test_territory("HND", 144, 0, 0, 0); 462 | test_territory("HP", 293, 0, 0, 408); 463 | test_territory("HR", 285, 0, 0, 408); 464 | test_territory("HRV", 120, 0, 0, 0); 465 | test_territory("HTI", 100, 0, 0, 0); 466 | test_territory("HUN", 137, 0, 0, 0); 467 | test_territory("IA", 369, 0, 0, 411); 468 | test_territory("ID", 381, 0, 0, 411); 469 | test_territory("IDN", 233, 0, 0, 0); 470 | test_territory("IL", 370, 0, 0, 411); 471 | test_territory("IMN", 52, 0, 0, 0); 472 | test_territory("IN", 416, 0, 1, 497); 473 | test_territory("IN", 357, 0, 1, 411); 474 | test_territory("IN-AN", 275, 0, 0, 408); 475 | test_territory("IN-AP", 304, 0, 0, 408); 476 | test_territory("IN-AR", 286, 0, 0, 408); 477 | test_territory("IN-AS", 287, 0, 0, 408); 478 | test_territory("IN-BR", 288, 0, 0, 408); 479 | test_territory("IN-CG", 295, 1, 0, 408); 480 | test_territory("IN-CH", 274, 0, 0, 408); 481 | test_territory("IN-CT", 295, 0, 0, 408); 482 | test_territory("IN-DD", 272, 0, 0, 408); 483 | test_territory("IN-DL", 277, 0, 0, 408); 484 | test_territory("IN-DN", 273, 0, 0, 408); 485 | test_territory("IN-GA", 290, 0, 0, 408); 486 | test_territory("IN-GJ", 300, 0, 0, 408); 487 | test_territory("IN-HP", 293, 0, 0, 408); 488 | test_territory("IN-HR", 285, 0, 0, 408); 489 | test_territory("IN-JH", 296, 0, 0, 408); 490 | test_territory("IN-JK", 294, 0, 0, 408); 491 | test_territory("IN-KA", 297, 0, 0, 408); 492 | test_territory("IN-KL", 291, 0, 0, 408); 493 | test_territory("IN-LD", 276, 0, 0, 408); 494 | test_territory("IN-MH", 305, 0, 0, 408); 495 | test_territory("IN-ML", 278, 0, 0, 408); 496 | test_territory("IN-MN", 280, 0, 0, 408); 497 | test_territory("IN-MP", 302, 0, 0, 408); 498 | test_territory("IN-MZ", 282, 0, 0, 408); 499 | test_territory("IN-NL", 279, 0, 0, 408); 500 | test_territory("IN-OD", 299, 1, 0, 408); 501 | test_territory("IN-OR", 299, 0, 0, 408); 502 | test_territory("IN-PB", 284, 0, 0, 408); 503 | test_territory("IN-PY", 307, 0, 0, 408); 504 | test_territory("IN-RJ", 298, 0, 0, 408); 505 | test_territory("IN-SK", 283, 0, 0, 408); 506 | test_territory("IN-TG", 303, 0, 0, 408); 507 | test_territory("IN-TN", 292, 0, 0, 408); 508 | test_territory("IN-TR", 281, 0, 0, 408); 509 | test_territory("IN-UK", 289, 1, 0, 408); 510 | test_territory("IN-UP", 306, 0, 0, 408); 511 | test_territory("IN-UT", 289, 0, 0, 408); 512 | test_territory("IN-WB", 301, 0, 0, 408); 513 | test_territory("IND", 408, 0, 0, 0); 514 | test_territory("IND-AN", 275, 0, 0, 408); 515 | test_territory("IND-AP", 304, 0, 0, 408); 516 | test_territory("IND-AR", 286, 0, 0, 408); 517 | test_territory("IND-AS", 287, 0, 0, 408); 518 | test_territory("IND-BR", 288, 0, 0, 408); 519 | test_territory("IND-CG", 295, 1, 0, 408); 520 | test_territory("IND-CH", 274, 0, 0, 408); 521 | test_territory("IND-CT", 295, 0, 0, 408); 522 | test_territory("IND-DD", 272, 0, 0, 408); 523 | test_territory("IND-DL", 277, 0, 0, 408); 524 | test_territory("IND-DN", 273, 0, 0, 408); 525 | test_territory("IND-GA", 290, 0, 0, 408); 526 | test_territory("IND-GJ", 300, 0, 0, 408); 527 | test_territory("IND-HP", 293, 0, 0, 408); 528 | test_territory("IND-HR", 285, 0, 0, 408); 529 | test_territory("IND-JH", 296, 0, 0, 408); 530 | test_territory("IND-JK", 294, 0, 0, 408); 531 | test_territory("IND-KA", 297, 0, 0, 408); 532 | test_territory("IND-KL", 291, 0, 0, 408); 533 | test_territory("IND-LD", 276, 0, 0, 408); 534 | test_territory("IND-MH", 305, 0, 0, 408); 535 | test_territory("IND-ML", 278, 0, 0, 408); 536 | test_territory("IND-MN", 280, 0, 0, 408); 537 | test_territory("IND-MP", 302, 0, 0, 408); 538 | test_territory("IND-MZ", 282, 0, 0, 408); 539 | test_territory("IND-NL", 279, 0, 0, 408); 540 | test_territory("IND-OD", 299, 1, 0, 408); 541 | test_territory("IND-OR", 299, 0, 0, 408); 542 | test_territory("IND-PB", 284, 0, 0, 408); 543 | test_territory("IND-PY", 307, 0, 0, 408); 544 | test_territory("IND-RJ", 298, 0, 0, 408); 545 | test_territory("IND-SK", 283, 0, 0, 408); 546 | test_territory("IND-TG", 303, 0, 0, 408); 547 | test_territory("IND-TN", 292, 0, 0, 408); 548 | test_territory("IND-TR", 281, 0, 0, 408); 549 | test_territory("IND-UK", 289, 1, 0, 408); 550 | test_territory("IND-UP", 306, 0, 0, 408); 551 | test_territory("IND-UT", 289, 0, 0, 408); 552 | test_territory("IND-WB", 301, 0, 0, 408); 553 | test_territory("IOT", 16, 0, 0, 0); 554 | test_territory("IRK", 477, 0, 0, 497); 555 | test_territory("IRL", 126, 0, 0, 0); 556 | test_territory("IRN", 230, 0, 0, 0); 557 | test_territory("IRQ", 188, 0, 0, 0); 558 | test_territory("ISL", 139, 0, 0, 0); 559 | test_territory("ISR", 93, 0, 0, 0); 560 | test_territory("ITA", 175, 0, 0, 0); 561 | test_territory("IVA", 423, 0, 0, 497); 562 | test_territory("JA", 259, 1, 0, 412); 563 | test_territory("JAL", 259, 0, 0, 412); 564 | test_territory("JAM", 80, 0, 0, 0); 565 | test_territory("JBT", 310, 0, 0, 409); 566 | test_territory("JEY", 21, 0, 0, 0); 567 | test_territory("JH", 296, 0, 0, 408); 568 | test_territory("JK", 294, 0, 0, 408); 569 | test_territory("JL", 516, 0, 0, 529); 570 | test_territory("JOR", 135, 0, 0, 0); 571 | test_territory("JPN", 185, 0, 0, 0); 572 | test_territory("JS", 505, 0, 0, 529); 573 | test_territory("JTN", 530, 1, 0, 0); 574 | test_territory("JX", 511, 0, 0, 529); 575 | test_territory("KA", 297, 0, 0, 408); 576 | test_territory("KAM", 489, 0, 0, 497); 577 | test_territory("KAZ", 270, 0, 0, 0); 578 | test_territory("KB", 419, 0, 0, 497); 579 | test_territory("KC", 420, 0, 0, 497); 580 | test_territory("KDA", 444, 0, 0, 497); 581 | test_territory("KEM", 482, 0, 0, 497); 582 | test_territory("KEN", 200, 0, 0, 0); 583 | test_territory("KGD", 415, 0, 0, 497); 584 | test_territory("KGN", 473, 0, 0, 497); 585 | test_territory("KGZ", 160, 0, 0, 0); 586 | test_territory("KHA", 493, 0, 0, 497); 587 | test_territory("KHM", 157, 0, 0, 0); 588 | test_territory("KI", 459, 0, 0, 497); 589 | test_territory("KIR", 59, 0, 0, 0); 590 | test_territory("KK", 481, 0, 0, 497); 591 | test_territory("KL", 445, 0, 1, 497); 592 | test_territory("KL", 291, 0, 1, 408); 593 | test_territory("KLU", 430, 0, 0, 497); 594 | test_territory("KM", 470, 0, 0, 497); 595 | test_territory("KNA", 32, 0, 0, 0); 596 | test_territory("KO", 454, 0, 0, 497); 597 | test_territory("KOR", 138, 0, 0, 0); 598 | test_territory("KOS", 442, 0, 0, 497); 599 | test_territory("KR", 452, 0, 0, 497); 600 | test_territory("KRS", 429, 0, 0, 497); 601 | test_territory("KS", 380, 0, 0, 411); 602 | test_territory("KWT", 89, 0, 0, 0); 603 | test_territory("KY", 358, 0, 0, 411); 604 | test_territory("KYA", 486, 0, 0, 497); 605 | test_territory("LA", 364, 0, 0, 411); 606 | test_territory("LAO", 163, 0, 0, 0); 607 | test_territory("LBN", 79, 0, 0, 0); 608 | test_territory("LBR", 143, 0, 0, 0); 609 | test_territory("LBY", 231, 0, 0, 0); 610 | test_territory("LCA", 53, 0, 0, 0); 611 | test_territory("LD", 276, 0, 0, 408); 612 | test_territory("LEN", 447, 0, 0, 497); 613 | test_territory("LIE", 25, 0, 0, 0); 614 | test_territory("LIP", 424, 0, 0, 497); 615 | test_territory("LKA", 124, 0, 0, 0); 616 | test_territory("LN", 508, 0, 0, 529); 617 | test_territory("LSO", 106, 0, 0, 0); 618 | test_territory("LTU", 123, 0, 0, 0); 619 | test_territory("LUX", 69, 0, 0, 0); 620 | test_territory("LVA", 122, 0, 0, 0); 621 | test_territory("MA", 351, 0, 1, 411); 622 | test_territory("MA", 336, 0, 1, 410); 623 | test_territory("MAC", 9, 0, 0, 0); 624 | test_territory("MAF", 11, 0, 0, 0); 625 | test_territory("MAG", 487, 0, 0, 497); 626 | test_territory("MAR", 189, 0, 0, 0); 627 | test_territory("MB", 400, 0, 0, 496); 628 | test_territory("MC", 9, 1, 0, 529); 629 | test_territory("MCO", 2, 0, 0, 0); 630 | test_territory("MD", 353, 0, 0, 411); 631 | test_territory("MDA", 108, 0, 0, 0); 632 | test_territory("MDG", 202, 0, 0, 0); 633 | test_territory("MDV", 35, 0, 0, 0); 634 | test_territory("ME", 460, 0, 1, 497); 635 | test_territory("ME", 356, 0, 1, 411); 636 | test_territory("ME", 241, 1, 1, 412); 637 | test_territory("MEX", 412, 0, 0, 0); 638 | test_territory("MEX-AG", 237, 1, 0, 412); 639 | test_territory("MEX-AGU", 237, 0, 0, 412); 640 | test_territory("MEX-BC", 254, 1, 0, 412); 641 | test_territory("MEX-BCN", 254, 0, 0, 412); 642 | test_territory("MEX-BCS", 257, 0, 0, 412); 643 | test_territory("MEX-BS", 257, 1, 0, 412); 644 | test_territory("MEX-CAM", 249, 0, 0, 412); 645 | test_territory("MEX-CH", 265, 1, 0, 412); 646 | test_territory("MEX-CHH", 265, 0, 0, 412); 647 | test_territory("MEX-CHP", 256, 0, 0, 412); 648 | test_territory("MEX-CL", 238, 0, 0, 412); 649 | test_territory("MEX-CM", 249, 1, 0, 412); 650 | test_territory("MEX-CO", 263, 1, 0, 412); 651 | test_territory("MEX-COA", 263, 0, 0, 412); 652 | test_territory("MEX-COL", 238, 1, 0, 412); 653 | test_territory("MEX-CS", 256, 1, 0, 412); 654 | test_territory("MEX-DF", 234, 1, 0, 412); 655 | test_territory("MEX-DG", 262, 1, 0, 412); 656 | test_territory("MEX-DIF", 234, 0, 0, 412); 657 | test_territory("MEX-DUR", 262, 0, 0, 412); 658 | test_territory("MEX-GR", 252, 1, 0, 412); 659 | test_territory("MEX-GRO", 252, 0, 0, 412); 660 | test_territory("MEX-GT", 244, 1, 0, 412); 661 | test_territory("MEX-GUA", 244, 0, 0, 412); 662 | test_territory("MEX-HG", 240, 1, 0, 412); 663 | test_territory("MEX-HID", 240, 0, 0, 412); 664 | test_territory("MEX-JA", 259, 1, 0, 412); 665 | test_territory("MEX-JAL", 259, 0, 0, 412); 666 | test_territory("MEX-ME", 241, 1, 0, 412); 667 | test_territory("MEX-MEX", 241, 1, 0, 412); 668 | test_territory("MEX-MI", 250, 1, 0, 412); 669 | test_territory("MEX-MIC", 250, 0, 0, 412); 670 | test_territory("MEX-MO", 236, 1, 0, 412); 671 | test_territory("MEX-MOR", 236, 0, 0, 412); 672 | test_territory("MEX-MX", 241, 0, 0, 412); 673 | test_territory("MEX-NA", 243, 1, 0, 412); 674 | test_territory("MEX-NAY", 243, 0, 0, 412); 675 | test_territory("MEX-NL", 253, 1, 0, 412); 676 | test_territory("MEX-NLE", 253, 0, 0, 412); 677 | test_territory("MEX-OA", 261, 1, 0, 412); 678 | test_territory("MEX-OAX", 261, 0, 0, 412); 679 | test_territory("MEX-PB", 245, 1, 0, 412); 680 | test_territory("MEX-PUE", 245, 0, 0, 412); 681 | test_territory("MEX-QE", 239, 1, 0, 412); 682 | test_territory("MEX-QR", 247, 1, 0, 412); 683 | test_territory("MEX-QUE", 239, 0, 0, 412); 684 | test_territory("MEX-ROO", 247, 0, 0, 412); 685 | test_territory("MEX-SI", 248, 1, 0, 412); 686 | test_territory("MEX-SIN", 248, 0, 0, 412); 687 | test_territory("MEX-SL", 251, 1, 0, 412); 688 | test_territory("MEX-SLP", 251, 0, 0, 412); 689 | test_territory("MEX-SO", 264, 1, 0, 412); 690 | test_territory("MEX-SON", 264, 0, 0, 412); 691 | test_territory("MEX-TAB", 242, 0, 0, 412); 692 | test_territory("MEX-TAM", 260, 0, 0, 412); 693 | test_territory("MEX-TAM", 260, 1, 0, 412); 694 | test_territory("MEX-TB", 242, 1, 0, 412); 695 | test_territory("MEX-TL", 235, 1, 0, 412); 696 | test_territory("MEX-TLA", 235, 0, 0, 412); 697 | test_territory("MEX-TM", 260, 1, 0, 412); 698 | test_territory("MEX-VE", 255, 1, 0, 412); 699 | test_territory("MEX-VER", 255, 0, 0, 412); 700 | test_territory("MEX-YU", 246, 1, 0, 412); 701 | test_territory("MEX-YUC", 246, 0, 0, 412); 702 | test_territory("MEX-ZA", 258, 1, 0, 412); 703 | test_territory("MEX-ZAC", 258, 0, 0, 412); 704 | test_territory("MG", 340, 0, 0, 410); 705 | test_territory("MH", 305, 0, 0, 408); 706 | test_territory("MHL", 27, 0, 0, 0); 707 | test_territory("MI", 384, 0, 1, 411); 708 | test_territory("MI", 250, 1, 1, 412); 709 | test_territory("MIC", 250, 0, 0, 412); 710 | test_territory("MID", 352, 1, 0, 411); 711 | test_territory("MKD", 98, 0, 0, 0); 712 | test_territory("ML", 278, 0, 0, 408); 713 | test_territory("MLI", 224, 0, 0, 0); 714 | test_territory("MLT", 37, 0, 0, 0); 715 | test_territory("MMR", 208, 0, 0, 0); 716 | test_territory("MN", 383, 0, 1, 411); 717 | test_territory("MN", 280, 0, 1, 408); 718 | test_territory("MNE", 85, 0, 0, 0); 719 | test_territory("MNG", 229, 0, 0, 0); 720 | test_territory("MNP", 49, 0, 0, 0); 721 | test_territory("MO", 456, 0, 1, 497); 722 | test_territory("MO", 374, 0, 1, 411); 723 | test_territory("MO", 236, 1, 1, 412); 724 | test_territory("MOR", 236, 0, 0, 412); 725 | test_territory("MOS", 436, 0, 0, 497); 726 | test_territory("MOW", 413, 0, 0, 497); 727 | test_territory("MOZ", 213, 0, 0, 0); 728 | test_territory("MP", 302, 0, 1, 408); 729 | test_territory("MP", 49, 1, 1, 411); 730 | test_territory("MRT", 219, 0, 0, 0); 731 | test_territory("MS", 363, 0, 1, 411); 732 | test_territory("MS", 338, 0, 1, 410); 733 | test_territory("MSR", 20, 0, 0, 0); 734 | test_territory("MT", 391, 0, 1, 411); 735 | test_territory("MT", 341, 0, 1, 410); 736 | test_territory("MTQ", 63, 0, 0, 0); 737 | test_territory("MUR", 451, 0, 0, 497); 738 | test_territory("MUS", 67, 0, 0, 0); 739 | test_territory("MWI", 147, 0, 0, 0); 740 | test_territory("MX", 241, 0, 0, 412); 741 | test_territory("MX-AG", 237, 1, 0, 412); 742 | test_territory("MX-AGU", 237, 0, 0, 412); 743 | test_territory("MX-BC", 254, 1, 0, 412); 744 | test_territory("MX-BCN", 254, 0, 0, 412); 745 | test_territory("MX-BCS", 257, 0, 0, 412); 746 | test_territory("MX-BS", 257, 1, 0, 412); 747 | test_territory("MX-CAM", 249, 0, 0, 412); 748 | test_territory("MX-CH", 265, 1, 0, 412); 749 | test_territory("MX-CHH", 265, 0, 0, 412); 750 | test_territory("MX-CHP", 256, 0, 0, 412); 751 | test_territory("MX-CL", 238, 0, 0, 412); 752 | test_territory("MX-CM", 249, 1, 0, 412); 753 | test_territory("MX-CO", 263, 1, 0, 412); 754 | test_territory("MX-COA", 263, 0, 0, 412); 755 | test_territory("MX-COL", 238, 1, 0, 412); 756 | test_territory("MX-CS", 256, 1, 0, 412); 757 | test_territory("MX-DF", 234, 1, 0, 412); 758 | test_territory("MX-DG", 262, 1, 0, 412); 759 | test_territory("MX-DIF", 234, 0, 0, 412); 760 | test_territory("MX-DUR", 262, 0, 0, 412); 761 | test_territory("MX-GR", 252, 1, 0, 412); 762 | test_territory("MX-GRO", 252, 0, 0, 412); 763 | test_territory("MX-GT", 244, 1, 0, 412); 764 | test_territory("MX-GUA", 244, 0, 0, 412); 765 | test_territory("MX-HG", 240, 1, 0, 412); 766 | test_territory("MX-HID", 240, 0, 0, 412); 767 | test_territory("MX-JA", 259, 1, 0, 412); 768 | test_territory("MX-JAL", 259, 0, 0, 412); 769 | test_territory("MX-ME", 241, 1, 0, 412); 770 | test_territory("MX-MEX", 241, 1, 0, 412); 771 | test_territory("MX-MI", 250, 1, 0, 412); 772 | test_territory("MX-MIC", 250, 0, 0, 412); 773 | test_territory("MX-MO", 236, 1, 0, 412); 774 | test_territory("MX-MOR", 236, 0, 0, 412); 775 | test_territory("MX-MX", 241, 0, 0, 412); 776 | test_territory("MX-NA", 243, 1, 0, 412); 777 | test_territory("MX-NAY", 243, 0, 0, 412); 778 | test_territory("MX-NL", 253, 1, 0, 412); 779 | test_territory("MX-NLE", 253, 0, 0, 412); 780 | test_territory("MX-OA", 261, 1, 0, 412); 781 | test_territory("MX-OAX", 261, 0, 0, 412); 782 | test_territory("MX-PB", 245, 1, 0, 412); 783 | test_territory("MX-PUE", 245, 0, 0, 412); 784 | test_territory("MX-QE", 239, 1, 0, 412); 785 | test_territory("MX-QR", 247, 1, 0, 412); 786 | test_territory("MX-QUE", 239, 0, 0, 412); 787 | test_territory("MX-ROO", 247, 0, 0, 412); 788 | test_territory("MX-SI", 248, 1, 0, 412); 789 | test_territory("MX-SIN", 248, 0, 0, 412); 790 | test_territory("MX-SL", 251, 1, 0, 412); 791 | test_territory("MX-SLP", 251, 0, 0, 412); 792 | test_territory("MX-SO", 264, 1, 0, 412); 793 | test_territory("MX-SON", 264, 0, 0, 412); 794 | test_territory("MX-TAB", 242, 0, 0, 412); 795 | test_territory("MX-TAM", 260, 0, 0, 412); 796 | test_territory("MX-TAM", 260, 1, 0, 412); 797 | test_territory("MX-TB", 242, 1, 0, 412); 798 | test_territory("MX-TL", 235, 1, 0, 412); 799 | test_territory("MX-TLA", 235, 0, 0, 412); 800 | test_territory("MX-TM", 260, 1, 0, 412); 801 | test_territory("MX-VE", 255, 1, 0, 412); 802 | test_territory("MX-VER", 255, 0, 0, 412); 803 | test_territory("MX-YU", 246, 1, 0, 412); 804 | test_territory("MX-YUC", 246, 0, 0, 412); 805 | test_territory("MX-ZA", 258, 1, 0, 412); 806 | test_territory("MX-ZAC", 258, 0, 0, 412); 807 | test_territory("MYS", 180, 0, 0, 0); 808 | test_territory("MYT", 40, 0, 0, 0); 809 | test_territory("MZ", 282, 0, 0, 408); 810 | test_territory("NA", 243, 1, 0, 412); 811 | test_territory("NAM", 214, 0, 0, 0); 812 | test_territory("NAY", 243, 0, 0, 412); 813 | test_territory("NB", 402, 0, 0, 496); 814 | test_territory("NC", 367, 0, 0, 411); 815 | test_territory("NCL", 91, 0, 0, 0); 816 | test_territory("ND", 376, 0, 0, 411); 817 | test_territory("NE", 379, 0, 0, 411); 818 | test_territory("NEN", 453, 0, 0, 497); 819 | test_territory("NER", 226, 0, 0, 0); 820 | test_territory("NF", 12, 1, 0, 409); 821 | test_territory("NFK", 12, 0, 0, 0); 822 | test_territory("NGA", 216, 0, 0, 0); 823 | test_territory("NGR", 440, 0, 0, 497); 824 | test_territory("NH", 349, 0, 0, 411); 825 | test_territory("NIC", 149, 0, 0, 0); 826 | test_territory("NIU", 31, 0, 0, 0); 827 | test_territory("NIZ", 457, 0, 0, 497); 828 | test_territory("NJ", 348, 0, 0, 411); 829 | test_territory("NL", 401, 0, 1, 496); 830 | test_territory("NL", 279, 0, 1, 408); 831 | test_territory("NL", 253, 1, 1, 412); 832 | test_territory("NLD", 113, 0, 0, 0); 833 | test_territory("NLE", 253, 0, 0, 412); 834 | test_territory("NM", 519, 0, 1, 529); 835 | test_territory("NM", 390, 0, 1, 411); 836 | test_territory("NOR", 179, 0, 0, 0); 837 | test_territory("NPL", 153, 0, 0, 0); 838 | test_territory("NRU", 7, 0, 0, 0); 839 | test_territory("NS", 403, 0, 0, 496); 840 | test_territory("NSW", 308, 0, 0, 409); 841 | test_territory("NT", 406, 0, 1, 496); 842 | test_territory("NT", 311, 0, 1, 409); 843 | test_territory("NU", 407, 0, 0, 496); 844 | test_territory("NV", 388, 0, 0, 411); 845 | test_territory("NVS", 478, 0, 0, 497); 846 | test_territory("NX", 502, 0, 0, 529); 847 | test_territory("NY", 368, 0, 0, 411); 848 | test_territory("NZL", 172, 0, 0, 0); 849 | test_territory("OA", 261, 1, 0, 412); 850 | test_territory("OAX", 261, 0, 0, 412); 851 | test_territory("OD", 299, 1, 0, 408); 852 | test_territory("OH", 361, 0, 0, 411); 853 | test_territory("OK", 375, 0, 0, 411); 854 | test_territory("OMN", 176, 0, 0, 0); 855 | test_territory("OMS", 480, 0, 0, 497); 856 | test_territory("ON", 397, 0, 0, 496); 857 | test_territory("OR", 386, 0, 1, 411); 858 | test_territory("OR", 299, 0, 1, 408); 859 | test_territory("ORE", 461, 0, 0, 497); 860 | test_territory("ORL", 425, 0, 0, 497); 861 | test_territory("PA", 362, 0, 1, 411); 862 | test_territory("PA", 342, 0, 1, 410); 863 | test_territory("PAK", 212, 0, 0, 0); 864 | test_territory("PAN", 128, 0, 0, 0); 865 | test_territory("PB", 323, 0, 1, 410); 866 | test_territory("PB", 284, 0, 1, 408); 867 | test_territory("PB", 245, 1, 1, 412); 868 | test_territory("PCN", 13, 0, 0, 0); 869 | test_territory("PE", 404, 0, 1, 496); 870 | test_territory("PE", 325, 0, 1, 410); 871 | test_territory("PER", 228, 0, 0, 0); 872 | test_territory("PHL", 174, 0, 0, 0); 873 | test_territory("PI", 333, 0, 0, 410); 874 | test_territory("PLW", 48, 0, 0, 0); 875 | test_territory("PM", 463, 0, 0, 497); 876 | test_territory("PNG", 192, 0, 0, 0); 877 | test_territory("PNZ", 458, 0, 0, 497); 878 | test_territory("PO", 491, 0, 0, 497); 879 | test_territory("POL", 177, 0, 0, 0); 880 | test_territory("PR", 329, 0, 1, 410); 881 | test_territory("PR", 77, 1, 1, 411); 882 | test_territory("PRI", 77, 0, 0, 0); 883 | test_territory("PRK", 148, 0, 0, 0); 884 | test_territory("PRT", 136, 0, 0, 0); 885 | test_territory("PRY", 187, 0, 0, 0); 886 | test_territory("PSE", 94, 0, 0, 0); 887 | test_territory("PSK", 441, 0, 0, 497); 888 | test_territory("PUE", 245, 0, 0, 412); 889 | test_territory("PY", 307, 0, 0, 408); 890 | test_territory("PYF", 72, 0, 0, 0); 891 | test_territory("QAT", 82, 0, 0, 0); 892 | test_territory("QC", 398, 0, 0, 496); 893 | test_territory("QE", 239, 1, 0, 412); 894 | test_territory("QH", 527, 0, 0, 529); 895 | test_territory("QLD", 316, 0, 0, 409); 896 | test_territory("QR", 247, 1, 0, 412); 897 | test_territory("QUE", 239, 0, 0, 412); 898 | test_territory("REU", 68, 0, 0, 0); 899 | test_territory("RI", 345, 0, 0, 411); 900 | test_territory("RJ", 320, 0, 1, 410); 901 | test_territory("RJ", 298, 0, 1, 408); 902 | test_territory("RN", 322, 0, 0, 410); 903 | test_territory("RO", 331, 0, 0, 410); 904 | test_territory("ROO", 247, 0, 0, 412); 905 | test_territory("ROS", 448, 0, 0, 497); 906 | test_territory("ROU", 164, 0, 0, 0); 907 | test_territory("RR", 330, 0, 0, 410); 908 | test_territory("RS", 335, 0, 0, 410); 909 | test_territory("RU", 497, 1, 0, 0); 910 | test_territory("RU-AD", 417, 0, 0, 497); 911 | test_territory("RU-AL", 483, 0, 0, 497); 912 | test_territory("RU-ALT", 484, 0, 0, 497); 913 | test_territory("RU-AMU", 494, 0, 0, 497); 914 | test_territory("RU-ARK", 455, 0, 0, 497); 915 | test_territory("RU-AST", 435, 0, 0, 497); 916 | test_territory("RU-BA", 464, 0, 0, 497); 917 | test_territory("RU-BE", 427, 0, 0, 497); 918 | test_territory("RU-BEL", 427, 1, 0, 497); 919 | test_territory("RU-BRY", 432, 0, 0, 497); 920 | test_territory("RU-BU", 475, 0, 0, 497); 921 | test_territory("RU-CE", 421, 0, 0, 497); 922 | test_territory("RU-CH", 474, 0, 0, 497); 923 | test_territory("RU-CHE", 474, 1, 0, 497); 924 | test_territory("RU-CHU", 488, 0, 0, 497); 925 | test_territory("RU-CU", 422, 0, 0, 497); 926 | test_territory("RU-DA", 438, 0, 0, 497); 927 | test_territory("RU-IN", 416, 0, 0, 497); 928 | test_territory("RU-IRK", 477, 0, 0, 497); 929 | test_territory("RU-IVA", 423, 0, 0, 497); 930 | test_territory("RU-KAM", 489, 0, 0, 497); 931 | test_territory("RU-KB", 419, 0, 0, 497); 932 | test_territory("RU-KC", 420, 0, 0, 497); 933 | test_territory("RU-KDA", 444, 0, 0, 497); 934 | test_territory("RU-KEM", 482, 0, 0, 497); 935 | test_territory("RU-KGD", 415, 0, 0, 497); 936 | test_territory("RU-KGN", 473, 0, 0, 497); 937 | test_territory("RU-KHA", 493, 0, 0, 497); 938 | test_territory("RU-KHM", 470, 1, 0, 497); 939 | test_territory("RU-KI", 459, 0, 0, 497); 940 | test_territory("RU-KIR", 459, 1, 0, 497); 941 | test_territory("RU-KK", 481, 0, 0, 497); 942 | test_territory("RU-KL", 445, 0, 0, 497); 943 | test_territory("RU-KLU", 430, 0, 0, 497); 944 | test_territory("RU-KM", 470, 0, 0, 497); 945 | test_territory("RU-KO", 454, 0, 0, 497); 946 | test_territory("RU-KOS", 442, 0, 0, 497); 947 | test_territory("RU-KR", 452, 0, 0, 497); 948 | test_territory("RU-KRS", 429, 0, 0, 497); 949 | test_territory("RU-KYA", 486, 0, 0, 497); 950 | test_territory("RU-LEN", 447, 0, 0, 497); 951 | test_territory("RU-LIP", 424, 0, 0, 497); 952 | test_territory("RU-MAG", 487, 0, 0, 497); 953 | test_territory("RU-ME", 460, 0, 0, 497); 954 | test_territory("RU-MO", 456, 0, 0, 497); 955 | test_territory("RU-MOS", 436, 0, 0, 497); 956 | test_territory("RU-MOW", 413, 0, 0, 497); 957 | test_territory("RU-MUR", 451, 0, 0, 497); 958 | test_territory("RU-NEN", 453, 0, 0, 497); 959 | test_territory("RU-NGR", 440, 0, 0, 497); 960 | test_territory("RU-NIZ", 457, 0, 0, 497); 961 | test_territory("RU-NVS", 478, 0, 0, 497); 962 | test_territory("RU-OMS", 480, 0, 0, 497); 963 | test_territory("RU-ORE", 461, 0, 0, 497); 964 | test_territory("RU-ORL", 425, 0, 0, 497); 965 | test_territory("RU-PER", 463, 1, 0, 497); 966 | test_territory("RU-PM", 463, 0, 0, 497); 967 | test_territory("RU-PNZ", 458, 0, 0, 497); 968 | test_territory("RU-PO", 491, 0, 0, 497); 969 | test_territory("RU-PRI", 491, 1, 0, 497); 970 | test_territory("RU-PSK", 441, 0, 0, 497); 971 | test_territory("RU-ROS", 448, 0, 0, 497); 972 | test_territory("RU-RYA", 434, 0, 0, 497); 973 | test_territory("RU-SA", 495, 0, 0, 497); 974 | test_territory("RU-SAK", 490, 0, 0, 497); 975 | test_territory("RU-SAM", 467, 0, 0, 497); 976 | test_territory("RU-SAR", 468, 0, 0, 497); 977 | test_territory("RU-SE", 418, 0, 0, 497); 978 | test_territory("RU-SMO", 437, 0, 0, 497); 979 | test_territory("RU-SPE", 414, 0, 0, 497); 980 | test_territory("RU-STA", 443, 0, 0, 497); 981 | test_territory("RU-SVE", 471, 0, 0, 497); 982 | test_territory("RU-TA", 466, 0, 0, 497); 983 | test_territory("RU-TAM", 431, 1, 0, 497); 984 | test_territory("RU-TOM", 479, 0, 0, 497); 985 | test_territory("RU-TT", 431, 0, 0, 497); 986 | test_territory("RU-TUL", 426, 0, 0, 497); 987 | test_territory("RU-TVE", 446, 0, 0, 497); 988 | test_territory("RU-TY", 485, 0, 0, 497); 989 | test_territory("RU-TYU", 472, 0, 0, 497); 990 | test_territory("RU-UD", 465, 0, 0, 497); 991 | test_territory("RU-ULY", 462, 0, 0, 497); 992 | test_territory("RU-VGG", 449, 0, 0, 497); 993 | test_territory("RU-VLA", 428, 0, 0, 497); 994 | test_territory("RU-VLG", 450, 0, 0, 497); 995 | test_territory("RU-VOR", 439, 0, 0, 497); 996 | test_territory("RU-YAN", 469, 0, 0, 497); 997 | test_territory("RU-YAR", 433, 0, 0, 497); 998 | test_territory("RU-YEV", 492, 0, 0, 497); 999 | test_territory("RU-ZAB", 476, 0, 0, 497); 1000 | test_territory("RUS", 497, 0, 0, 0); 1001 | test_territory("RUS-AD", 417, 0, 0, 497); 1002 | test_territory("RUS-AL", 483, 0, 0, 497); 1003 | test_territory("RUS-ALT", 484, 0, 0, 497); 1004 | test_territory("RUS-AMU", 494, 0, 0, 497); 1005 | test_territory("RUS-ARK", 455, 0, 0, 497); 1006 | test_territory("RUS-AST", 435, 0, 0, 497); 1007 | test_territory("RUS-BA", 464, 0, 0, 497); 1008 | test_territory("RUS-BE", 427, 0, 0, 497); 1009 | test_territory("RUS-BEL", 427, 1, 0, 497); 1010 | test_territory("RUS-BRY", 432, 0, 0, 497); 1011 | test_territory("RUS-BU", 475, 0, 0, 497); 1012 | test_territory("RUS-CE", 421, 0, 0, 497); 1013 | test_territory("RUS-CH", 474, 0, 0, 497); 1014 | test_territory("RUS-CHE", 474, 1, 0, 497); 1015 | test_territory("RUS-CHU", 488, 0, 0, 497); 1016 | test_territory("RUS-CU", 422, 0, 0, 497); 1017 | test_territory("RUS-DA", 438, 0, 0, 497); 1018 | test_territory("RUS-IN", 416, 0, 0, 497); 1019 | test_territory("RUS-IRK", 477, 0, 0, 497); 1020 | test_territory("RUS-IVA", 423, 0, 0, 497); 1021 | test_territory("RUS-KAM", 489, 0, 0, 497); 1022 | test_territory("RUS-KB", 419, 0, 0, 497); 1023 | test_territory("RUS-KC", 420, 0, 0, 497); 1024 | test_territory("RUS-KDA", 444, 0, 0, 497); 1025 | test_territory("RUS-KEM", 482, 0, 0, 497); 1026 | test_territory("RUS-KGD", 415, 0, 0, 497); 1027 | test_territory("RUS-KGN", 473, 0, 0, 497); 1028 | test_territory("RUS-KHA", 493, 0, 0, 497); 1029 | test_territory("RUS-KHM", 470, 1, 0, 497); 1030 | test_territory("RUS-KI", 459, 0, 0, 497); 1031 | test_territory("RUS-KIR", 459, 1, 0, 497); 1032 | test_territory("RUS-KK", 481, 0, 0, 497); 1033 | test_territory("RUS-KL", 445, 0, 0, 497); 1034 | test_territory("RUS-KLU", 430, 0, 0, 497); 1035 | test_territory("RUS-KM", 470, 0, 0, 497); 1036 | test_territory("RUS-KO", 454, 0, 0, 497); 1037 | test_territory("RUS-KOS", 442, 0, 0, 497); 1038 | test_territory("RUS-KR", 452, 0, 0, 497); 1039 | test_territory("RUS-KRS", 429, 0, 0, 497); 1040 | test_territory("RUS-KYA", 486, 0, 0, 497); 1041 | test_territory("RUS-LEN", 447, 0, 0, 497); 1042 | test_territory("RUS-LIP", 424, 0, 0, 497); 1043 | test_territory("RUS-MAG", 487, 0, 0, 497); 1044 | test_territory("RUS-ME", 460, 0, 0, 497); 1045 | test_territory("RUS-MO", 456, 0, 0, 497); 1046 | test_territory("RUS-MOS", 436, 0, 0, 497); 1047 | test_territory("RUS-MOW", 413, 0, 0, 497); 1048 | test_territory("RUS-MUR", 451, 0, 0, 497); 1049 | test_territory("RUS-NEN", 453, 0, 0, 497); 1050 | test_territory("RUS-NGR", 440, 0, 0, 497); 1051 | test_territory("RUS-NIZ", 457, 0, 0, 497); 1052 | test_territory("RUS-NVS", 478, 0, 0, 497); 1053 | test_territory("RUS-OMS", 480, 0, 0, 497); 1054 | test_territory("RUS-ORE", 461, 0, 0, 497); 1055 | test_territory("RUS-ORL", 425, 0, 0, 497); 1056 | test_territory("RUS-PER", 463, 1, 0, 497); 1057 | test_territory("RUS-PM", 463, 0, 0, 497); 1058 | test_territory("RUS-PNZ", 458, 0, 0, 497); 1059 | test_territory("RUS-PO", 491, 0, 0, 497); 1060 | test_territory("RUS-PRI", 491, 1, 0, 497); 1061 | test_territory("RUS-PSK", 441, 0, 0, 497); 1062 | test_territory("RUS-ROS", 448, 0, 0, 497); 1063 | test_territory("RUS-RYA", 434, 0, 0, 497); 1064 | test_territory("RUS-SA", 495, 0, 0, 497); 1065 | test_territory("RUS-SAK", 490, 0, 0, 497); 1066 | test_territory("RUS-SAM", 467, 0, 0, 497); 1067 | test_territory("RUS-SAR", 468, 0, 0, 497); 1068 | test_territory("RUS-SE", 418, 0, 0, 497); 1069 | test_territory("RUS-SMO", 437, 0, 0, 497); 1070 | test_territory("RUS-SPE", 414, 0, 0, 497); 1071 | test_territory("RUS-STA", 443, 0, 0, 497); 1072 | test_territory("RUS-SVE", 471, 0, 0, 497); 1073 | test_territory("RUS-TA", 466, 0, 0, 497); 1074 | test_territory("RUS-TAM", 431, 1, 0, 497); 1075 | test_territory("RUS-TOM", 479, 0, 0, 497); 1076 | test_territory("RUS-TT", 431, 0, 0, 497); 1077 | test_territory("RUS-TUL", 426, 0, 0, 497); 1078 | test_territory("RUS-TVE", 446, 0, 0, 497); 1079 | test_territory("RUS-TY", 485, 0, 0, 497); 1080 | test_territory("RUS-TYU", 472, 0, 0, 497); 1081 | test_territory("RUS-UD", 465, 0, 0, 497); 1082 | test_territory("RUS-ULY", 462, 0, 0, 497); 1083 | test_territory("RUS-VGG", 449, 0, 0, 497); 1084 | test_territory("RUS-VLA", 428, 0, 0, 497); 1085 | test_territory("RUS-VLG", 450, 0, 0, 497); 1086 | test_territory("RUS-VOR", 439, 0, 0, 497); 1087 | test_territory("RUS-YAN", 469, 0, 0, 497); 1088 | test_territory("RUS-YAR", 433, 0, 0, 497); 1089 | test_territory("RUS-YEV", 492, 0, 0, 497); 1090 | test_territory("RUS-ZAB", 476, 0, 0, 497); 1091 | test_territory("RWA", 99, 0, 0, 0); 1092 | test_territory("RYA", 434, 0, 0, 497); 1093 | test_territory("SA", 495, 0, 1, 497); 1094 | test_territory("SA", 312, 0, 1, 409); 1095 | test_territory("SAK", 490, 0, 0, 497); 1096 | test_territory("SAM", 467, 0, 0, 497); 1097 | test_territory("SAR", 468, 0, 0, 497); 1098 | test_territory("SAU", 267, 0, 0, 0); 1099 | test_territory("SC", 523, 0, 1, 529); 1100 | test_territory("SC", 355, 0, 1, 411); 1101 | test_territory("SC", 324, 0, 1, 410); 1102 | test_territory("SD", 509, 0, 1, 529); 1103 | test_territory("SD", 378, 0, 1, 411); 1104 | test_territory("SDN", 232, 0, 0, 0); 1105 | test_territory("SE", 418, 0, 1, 497); 1106 | test_territory("SE", 318, 0, 1, 410); 1107 | test_territory("SEN", 159, 0, 0, 0); 1108 | test_territory("SGP", 55, 0, 0, 0); 1109 | test_territory("SGS", 71, 0, 0, 0); 1110 | test_territory("SH", 498, 0, 0, 529); 1111 | test_territory("SHN", 36, 0, 0, 0); 1112 | test_territory("SI", 248, 1, 0, 412); 1113 | test_territory("SIN", 248, 0, 0, 412); 1114 | test_territory("SJM", 41, 0, 0, 0); 1115 | test_territory("SK", 399, 0, 1, 496); 1116 | test_territory("SK", 283, 0, 1, 408); 1117 | test_territory("SL", 251, 1, 0, 412); 1118 | test_territory("SLB", 104, 0, 0, 0); 1119 | test_territory("SLE", 127, 0, 0, 0); 1120 | test_territory("SLP", 251, 0, 0, 412); 1121 | test_territory("SLV", 95, 0, 0, 0); 1122 | test_territory("SMO", 437, 0, 0, 497); 1123 | test_territory("SMR", 17, 0, 0, 0); 1124 | test_territory("SN", 518, 0, 0, 529); 1125 | test_territory("SO", 264, 1, 0, 412); 1126 | test_territory("SOM", 206, 0, 0, 0); 1127 | test_territory("SON", 264, 0, 0, 412); 1128 | test_territory("SP", 332, 0, 0, 410); 1129 | test_territory("SPE", 414, 0, 0, 497); 1130 | test_territory("SPM", 30, 0, 0, 0); 1131 | test_territory("SRB", 134, 0, 0, 0); 1132 | test_territory("SSD", 204, 0, 0, 0); 1133 | test_territory("STA", 443, 0, 0, 497); 1134 | test_territory("STP", 61, 0, 0, 0); 1135 | test_territory("SUR", 155, 0, 0, 0); 1136 | test_territory("SVE", 471, 0, 0, 497); 1137 | test_territory("SVK", 117, 0, 0, 0); 1138 | test_territory("SVN", 92, 0, 0, 0); 1139 | test_territory("SWE", 191, 0, 0, 0); 1140 | test_territory("SWZ", 88, 0, 0, 0); 1141 | test_territory("SX", 510, 0, 0, 529); 1142 | test_territory("SXM", 10, 0, 0, 0); 1143 | test_territory("SYC", 47, 0, 0, 0); 1144 | test_territory("SYR", 158, 0, 0, 0); 1145 | test_territory("TA", 466, 0, 0, 497); 1146 | test_territory("TAA", 36, 1, 0, 0); 1147 | test_territory("TAB", 242, 0, 0, 412); 1148 | test_territory("TAM", 260, 0, 0, 412); 1149 | test_territory("TAS", 313, 0, 0, 409); 1150 | test_territory("TB", 242, 1, 0, 412); 1151 | test_territory("TCA", 60, 0, 0, 0); 1152 | test_territory("TCD", 227, 0, 0, 0); 1153 | test_territory("TG", 303, 0, 0, 408); 1154 | test_territory("TGO", 121, 0, 0, 0); 1155 | test_territory("THA", 196, 0, 0, 0); 1156 | test_territory("TJ", 499, 0, 0, 529); 1157 | test_territory("TJK", 151, 0, 0, 0); 1158 | test_territory("TKL", 4, 0, 0, 0); 1159 | test_territory("TKM", 194, 0, 0, 0); 1160 | test_territory("TL", 235, 1, 0, 412); 1161 | test_territory("TLA", 235, 0, 0, 412); 1162 | test_territory("TLS", 87, 0, 0, 0); 1163 | test_territory("TM", 260, 1, 0, 412); 1164 | test_territory("TN", 359, 0, 1, 411); 1165 | test_territory("TN", 292, 0, 1, 408); 1166 | test_territory("TO", 334, 0, 0, 410); 1167 | test_territory("TOM", 479, 0, 0, 497); 1168 | test_territory("TON", 56, 0, 0, 0); 1169 | test_territory("TR", 281, 0, 0, 408); 1170 | test_territory("TT", 431, 0, 0, 497); 1171 | test_territory("TTO", 74, 0, 0, 0); 1172 | test_territory("TUL", 426, 0, 0, 497); 1173 | test_territory("TUN", 154, 0, 0, 0); 1174 | test_territory("TUR", 211, 0, 0, 0); 1175 | test_territory("TUV", 8, 0, 0, 0); 1176 | test_territory("TVE", 446, 0, 0, 497); 1177 | test_territory("TW", 110, 1, 0, 529); 1178 | test_territory("TWN", 110, 0, 0, 0); 1179 | test_territory("TX", 393, 0, 0, 411); 1180 | test_territory("TY", 485, 0, 0, 497); 1181 | test_territory("TYU", 472, 0, 0, 497); 1182 | test_territory("TZA", 217, 0, 0, 0); 1183 | test_territory("UD", 465, 0, 0, 497); 1184 | test_territory("UGA", 166, 0, 0, 0); 1185 | test_territory("UK", 289, 1, 0, 408); 1186 | test_territory("UKR", 203, 0, 0, 0); 1187 | test_territory("ULY", 462, 0, 0, 497); 1188 | test_territory("UM", 530, 1, 0, 411); 1189 | test_territory("UMI", 530, 0, 0, 0); 1190 | test_territory("UP", 306, 0, 0, 408); 1191 | test_territory("URY", 156, 0, 0, 0); 1192 | test_territory("US", 411, 1, 0, 0); 1193 | test_territory("US-AK", 394, 0, 0, 411); 1194 | test_territory("US-AL", 365, 0, 0, 411); 1195 | test_territory("US-AR", 366, 0, 0, 411); 1196 | test_territory("US-AS", 28, 1, 0, 411); 1197 | test_territory("US-AZ", 389, 0, 0, 411); 1198 | test_territory("US-CA", 392, 0, 0, 411); 1199 | test_territory("US-CO", 387, 0, 0, 411); 1200 | test_territory("US-CT", 347, 0, 0, 411); 1201 | test_territory("US-DC", 344, 0, 0, 411); 1202 | test_territory("US-DE", 346, 0, 0, 411); 1203 | test_territory("US-FL", 373, 0, 0, 411); 1204 | test_territory("US-GA", 371, 0, 0, 411); 1205 | test_territory("US-GU", 51, 1, 0, 411); 1206 | test_territory("US-HI", 352, 0, 0, 411); 1207 | test_territory("US-IA", 369, 0, 0, 411); 1208 | test_territory("US-ID", 381, 0, 0, 411); 1209 | test_territory("US-IL", 370, 0, 0, 411); 1210 | test_territory("US-IN", 357, 0, 0, 411); 1211 | test_territory("US-KS", 380, 0, 0, 411); 1212 | test_territory("US-KY", 358, 0, 0, 411); 1213 | test_territory("US-LA", 364, 0, 0, 411); 1214 | test_territory("US-MA", 351, 0, 0, 411); 1215 | test_territory("US-MD", 353, 0, 0, 411); 1216 | test_territory("US-ME", 356, 0, 0, 411); 1217 | test_territory("US-MI", 384, 0, 0, 411); 1218 | test_territory("US-MID", 352, 1, 0, 411); 1219 | test_territory("US-MN", 383, 0, 0, 411); 1220 | test_territory("US-MO", 374, 0, 0, 411); 1221 | test_territory("US-MP", 49, 1, 0, 411); 1222 | test_territory("US-MS", 363, 0, 0, 411); 1223 | test_territory("US-MT", 391, 0, 0, 411); 1224 | test_territory("US-NC", 367, 0, 0, 411); 1225 | test_territory("US-ND", 376, 0, 0, 411); 1226 | test_territory("US-NE", 379, 0, 0, 411); 1227 | test_territory("US-NH", 349, 0, 0, 411); 1228 | test_territory("US-NJ", 348, 0, 0, 411); 1229 | test_territory("US-NM", 390, 0, 0, 411); 1230 | test_territory("US-NV", 388, 0, 0, 411); 1231 | test_territory("US-NY", 368, 0, 0, 411); 1232 | test_territory("US-OH", 361, 0, 0, 411); 1233 | test_territory("US-OK", 375, 0, 0, 411); 1234 | test_territory("US-OR", 386, 0, 0, 411); 1235 | test_territory("US-PA", 362, 0, 0, 411); 1236 | test_territory("US-PR", 77, 1, 0, 411); 1237 | test_territory("US-RI", 345, 0, 0, 411); 1238 | test_territory("US-SC", 355, 0, 0, 411); 1239 | test_territory("US-SD", 378, 0, 0, 411); 1240 | test_territory("US-TN", 359, 0, 0, 411); 1241 | test_territory("US-TX", 393, 0, 0, 411); 1242 | test_territory("US-UM", 530, 1, 0, 411); 1243 | test_territory("US-UT", 382, 0, 0, 411); 1244 | test_territory("US-VA", 360, 0, 0, 411); 1245 | test_territory("US-VI", 39, 1, 0, 411); 1246 | test_territory("US-VT", 350, 0, 0, 411); 1247 | test_territory("US-WA", 377, 0, 0, 411); 1248 | test_territory("US-WI", 372, 0, 0, 411); 1249 | test_territory("US-WV", 354, 0, 0, 411); 1250 | test_territory("US-WY", 385, 0, 0, 411); 1251 | test_territory("USA", 411, 0, 0, 0); 1252 | test_territory("USA-AK", 394, 0, 0, 411); 1253 | test_territory("USA-AL", 365, 0, 0, 411); 1254 | test_territory("USA-AR", 366, 0, 0, 411); 1255 | test_territory("USA-AS", 28, 1, 0, 411); 1256 | test_territory("USA-AZ", 389, 0, 0, 411); 1257 | test_territory("USA-CA", 392, 0, 0, 411); 1258 | test_territory("USA-CO", 387, 0, 0, 411); 1259 | test_territory("USA-CT", 347, 0, 0, 411); 1260 | test_territory("USA-DC", 344, 0, 0, 411); 1261 | test_territory("USA-DE", 346, 0, 0, 411); 1262 | test_territory("USA-FL", 373, 0, 0, 411); 1263 | test_territory("USA-GA", 371, 0, 0, 411); 1264 | test_territory("USA-GU", 51, 1, 0, 411); 1265 | test_territory("USA-HI", 352, 0, 0, 411); 1266 | test_territory("USA-IA", 369, 0, 0, 411); 1267 | test_territory("USA-ID", 381, 0, 0, 411); 1268 | test_territory("USA-IL", 370, 0, 0, 411); 1269 | test_territory("USA-IN", 357, 0, 0, 411); 1270 | test_territory("USA-KS", 380, 0, 0, 411); 1271 | test_territory("USA-KY", 358, 0, 0, 411); 1272 | test_territory("USA-LA", 364, 0, 0, 411); 1273 | test_territory("USA-MA", 351, 0, 0, 411); 1274 | test_territory("USA-MD", 353, 0, 0, 411); 1275 | test_territory("USA-ME", 356, 0, 0, 411); 1276 | test_territory("USA-MI", 384, 0, 0, 411); 1277 | test_territory("USA-MID", 352, 1, 0, 411); 1278 | test_territory("USA-MN", 383, 0, 0, 411); 1279 | test_territory("USA-MO", 374, 0, 0, 411); 1280 | test_territory("USA-MP", 49, 1, 0, 411); 1281 | test_territory("USA-MS", 363, 0, 0, 411); 1282 | test_territory("USA-MT", 391, 0, 0, 411); 1283 | test_territory("USA-NC", 367, 0, 0, 411); 1284 | test_territory("USA-ND", 376, 0, 0, 411); 1285 | test_territory("USA-NE", 379, 0, 0, 411); 1286 | test_territory("USA-NH", 349, 0, 0, 411); 1287 | test_territory("USA-NJ", 348, 0, 0, 411); 1288 | test_territory("USA-NM", 390, 0, 0, 411); 1289 | test_territory("USA-NV", 388, 0, 0, 411); 1290 | test_territory("USA-NY", 368, 0, 0, 411); 1291 | test_territory("USA-OH", 361, 0, 0, 411); 1292 | test_territory("USA-OK", 375, 0, 0, 411); 1293 | test_territory("USA-OR", 386, 0, 0, 411); 1294 | test_territory("USA-PA", 362, 0, 0, 411); 1295 | test_territory("USA-PR", 77, 1, 0, 411); 1296 | test_territory("USA-RI", 345, 0, 0, 411); 1297 | test_territory("USA-SC", 355, 0, 0, 411); 1298 | test_territory("USA-SD", 378, 0, 0, 411); 1299 | test_territory("USA-TN", 359, 0, 0, 411); 1300 | test_territory("USA-TX", 393, 0, 0, 411); 1301 | test_territory("USA-UM", 530, 1, 0, 411); 1302 | test_territory("USA-UT", 382, 0, 0, 411); 1303 | test_territory("USA-VA", 360, 0, 0, 411); 1304 | test_territory("USA-VI", 39, 1, 0, 411); 1305 | test_territory("USA-VT", 350, 0, 0, 411); 1306 | test_territory("USA-WA", 377, 0, 0, 411); 1307 | test_territory("USA-WI", 372, 0, 0, 411); 1308 | test_territory("USA-WV", 354, 0, 0, 411); 1309 | test_territory("USA-WY", 385, 0, 0, 411); 1310 | test_territory("UT", 382, 0, 1, 411); 1311 | test_territory("UT", 289, 0, 1, 408); 1312 | test_territory("UZB", 190, 0, 0, 0); 1313 | test_territory("VA", 360, 0, 0, 411); 1314 | test_territory("VAT", 1, 0, 0, 0); 1315 | test_territory("VCT", 42, 0, 0, 0); 1316 | test_territory("VE", 255, 1, 0, 412); 1317 | test_territory("VEN", 215, 0, 0, 0); 1318 | test_territory("VER", 255, 0, 0, 412); 1319 | test_territory("VGB", 24, 0, 0, 0); 1320 | test_territory("VGG", 449, 0, 0, 497); 1321 | test_territory("VI", 39, 1, 0, 411); 1322 | test_territory("VIC", 314, 0, 0, 409); 1323 | test_territory("VIR", 39, 0, 0, 0); 1324 | test_territory("VLA", 428, 0, 0, 497); 1325 | test_territory("VLG", 450, 0, 0, 497); 1326 | test_territory("VNM", 181, 0, 0, 0); 1327 | test_territory("VOR", 439, 0, 0, 497); 1328 | test_territory("VT", 350, 0, 0, 411); 1329 | test_territory("VUT", 84, 0, 0, 0); 1330 | test_territory("WA", 377, 0, 1, 411); 1331 | test_territory("WA", 315, 0, 1, 409); 1332 | test_territory("WAK", 27, 1, 0, 0); 1333 | test_territory("WB", 301, 0, 0, 408); 1334 | test_territory("WI", 372, 0, 0, 411); 1335 | test_territory("WLF", 23, 0, 0, 0); 1336 | test_territory("WSM", 70, 0, 0, 0); 1337 | test_territory("WV", 354, 0, 0, 411); 1338 | test_territory("WY", 385, 0, 0, 411); 1339 | test_territory("XJ", 528, 0, 0, 529); 1340 | test_territory("XZ", 525, 0, 0, 529); 1341 | test_territory("YAN", 469, 0, 0, 497); 1342 | test_territory("YAR", 433, 0, 0, 497); 1343 | test_territory("YEM", 197, 0, 0, 0); 1344 | test_territory("YEV", 492, 0, 0, 497); 1345 | test_territory("YN", 524, 0, 0, 529); 1346 | test_territory("YT", 405, 0, 0, 496); 1347 | test_territory("YU", 246, 1, 0, 412); 1348 | test_territory("YUC", 246, 0, 0, 412); 1349 | test_territory("ZA", 258, 1, 0, 412); 1350 | test_territory("ZAB", 476, 0, 0, 497); 1351 | test_territory("ZAC", 258, 0, 0, 412); 1352 | test_territory("ZAF", 223, 0, 0, 0); 1353 | test_territory("ZJ", 504, 0, 0, 529); 1354 | test_territory("ZMB", 209, 0, 0, 0); 1355 | test_territory("ZWE", 186, 0, 0, 0); 1356 | } 1357 | 1358 | -------------------------------------------------------------------------------- /unittest/unittest.html: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | Mapcode Javascript Unit Tests 20 | 21 | 22 | 23 | 24 | 32 | 33 | 34 | 35 |

Mapcode Javascript Unit Tests

36 | 37 |
38 |
39 | 40 | 734 | 735 | 736 | 737 | 738 | --------------------------------------------------------------------------------