File indexing completed on 2024-05-05 03:55:01
0001 # SPDX-FileCopyrightText: 2021 Volker Krause <vkrause@kde.org> 0002 # SPDX-License-Identifier: LGPL-2.0-or-later 0003 0004 # data sources 0005 TZDATA_VERSION = '2020d' 0006 TZDATA_URL = f"https://github.com/evansiroky/timezone-boundary-builder/releases/download/{TZDATA_VERSION}/timezones.shapefile.zip" 0007 ISO3166_1_VERSION = '2021-08-16' 0008 ISO3166_1_URL = f"https://volkerkrause.eu/~vkrause/iso3166-boundaries/iso3166-1-boundaries.shp-{ISO3166_1_VERSION}.zip" 0009 ISO3166_2_VERSION = ISO3166_1_VERSION 0010 ISO3166_2_URL = f"https://volkerkrause.eu/~vkrause/iso3166-boundaries/iso3166-2-boundaries.shp-{ISO3166_2_VERSION}.zip" 0011 0012 # ISO 3166-1 code mappings 0013 # This is for codes that should be unconditionally replaced, which is mainly useful 0014 # for certain historical or political corner-cases or "non-countries" like Antarctica 0015 ISO3166_1_MAP = { 0016 'AQ': None, 0017 'AX': 'FI', 0018 'SJ': 'NO', 0019 'UM': 'US' 0020 } 0021 0022 # ISO 3166-1 overlap disambiguation 0023 # This is mainly relevant for oversees territories that both have their own code 0024 # as well that of the country they belong to 0025 ISO3166_1_DISAMBIGUATION_MAP = { 0026 ( 'AS', 'US' ), 0027 ( 'AW', 'NL' ), 0028 ( 'BL', 'FR' ), 0029 ( 'BQ', 'NL' ), 0030 ( 'BT', 'CN' ), 0031 ( 'CC', 'AU' ), 0032 ( 'CW', 'NL' ), 0033 ( 'CX', 'AU' ), 0034 ( 'GF', 'FR' ), 0035 ( 'GP', 'FR' ), 0036 ( 'GU', 'US' ), 0037 ( 'HK', 'CN' ), 0038 ( 'HT', 'US' ), 0039 ( 'MF', 'FR' ), 0040 ( 'MO', 'CN' ), 0041 ( 'MP', 'US' ), 0042 ( 'MQ', 'FR' ), 0043 ( 'NC', 'FR' ), 0044 ( 'NF', 'AU' ), 0045 ( 'PF', 'FR' ), 0046 ( 'PM', 'FR' ), 0047 ( 'PR', 'US' ), 0048 ( 'RE', 'FR' ), 0049 ( 'SX', 'NL' ), 0050 ( 'TF', 'FR' ), 0051 ( 'VI', 'US' ), 0052 ( 'WF', 'FR' ), 0053 ( 'YT', 'FR' ) 0054 } 0055 0056 # ISO 3166-2 filter configuration 0057 # most of those are sub-subdivisions 0058 ISO3166_2_FILTER = [ 0059 { 'country': 'BD', 'admin_level': 5 }, 0060 { 'country': 'BE', 'admin_level': 6 }, 0061 { 'country': 'BF', 'admin_level': 5 }, 0062 { 'country': 'CZ', 'admin_level': 7 }, 0063 { 'country': 'ES', 'admin_level': 6 }, 0064 { 'country': 'FR', 'admin_level': 5 }, 0065 { 'country': 'FR', 'admin_level': 6 }, 0066 { 'country': 'GB', 'admin_level': 6 }, 0067 { 'country': 'GB', 'admin_level': 8 }, 0068 { 'country': 'GN', 'admin_level': 6 }, 0069 { 'country': 'GQ', 'admin_level': 4 }, 0070 { 'country': 'GW', 'admin_level': 4 }, 0071 { 'country': 'IE', 'admin_level': 6 }, 0072 { 'country': 'IE', 'admin_level': 7 }, 0073 { 'country': 'IT', 'admin_level': 6 }, 0074 { 'country': 'LK', 'admin_level': 5 }, 0075 { 'country': 'LT', 'admin_level': 5 }, 0076 { 'country': 'MA', 'admin_level': 5 }, 0077 { 'country': 'MW', 'admin_level': 4 }, 0078 { 'country': 'NP', 'admin_level': 4 }, 0079 { 'country': 'NP', 'admin_level': 5 }, 0080 { 'country': 'PH', 'admin_level': 4 }, 0081 { 'country': 'UG', 'admin_level': 4 } 0082 ] 0083 0084 0085 # Timezone mapping 0086 # use this to replace timezone ids with an equivalent 0087 # this is mainly useful for filtering out timezones of limited practical or merely historical relevance, 0088 # trading historical accuracy for practical usability for current and future date/time values 0089 TZID_MAP = { 0090 'America/Argentina/Catamarca': 'America/Argentina/Buenos_Aires', 0091 'America/Argentina/Cordoba': 'America/Argentina/Buenos_Aires', 0092 'America/Argentina/Jujuy': 'America/Argentina/Buenos_Aires', 0093 'America/Argentina/La_Rioja': 'America/Argentina/Buenos_Aires', 0094 'America/Argentina/Mendoza': 'America/Argentina/Buenos_Aires', 0095 'America/Argentina/Rio_Gallegos': 'America/Argentina/Buenos_Aires', 0096 'America/Argentina/Salta': 'America/Argentina/Buenos_Aires', 0097 'America/Argentina/San_Juan': 'America/Argentina/Buenos_Aires', 0098 'America/Argentina/San_Luis': 'America/Argentina/Buenos_Aires', 0099 'America/Argentina/Tucuman': 'America/Argentina/Buenos_Aires', 0100 'America/Argentina/Ushuaia': 'America/Argentina/Buenos_Aires', 0101 'America/Nipigon': 'America/Toronto', 0102 'Arctic/Longyearbyen': 'Europe/Oslo', 0103 'Asia/Famagusta': 'Asia/Nicosia', 0104 'Asia/Kuching': 'Asia/Kuala_Lumpur', 0105 'Europe/Busingen': 'Europe/Berlin', 0106 'Europe/Mariehamn': 'Europe/Helsinki' 0107 } 0108 0109 # 0110 # parameters for the spatial index 0111 # 0112 featureAreaRatioThreshold = 0.02 # 1% at zDepth 11 is ~150m 0113 zDepth = 11 # minimum tile size is 1/(2^zdepth), amount of bits needed to store z index is 2*zDepth 0114 0115 # z-order curve coverage parameters 0116 xStart = -180 0117 xRange = 360 0118 # cut out artic regions (starting at 60°S and 80°N), that saves about 23% z-order curve coverage which we 0119 # can better use to increase precision in more relevant areas 0120 yStart = -60 0121 yRange = 140 0122 0123 0124 # constants 0125 LOG_CATEGORY = 'KI18n Data Generator'