forked from organicmaps/organicmaps
Changed countries file format to JSON
This commit is contained in:
parent
95d4168b9b
commit
0345b017ff
11 changed files with 713 additions and 637 deletions
|
@ -1,366 +1,458 @@
|
|||
Africa
|
||||
dz:Algeria
|
||||
ao:Angola
|
||||
bj:Benin
|
||||
bw:Botswana
|
||||
bf:Burkina Faso
|
||||
bi:Burundi
|
||||
cm:Cameroon
|
||||
cf:Central African Republic
|
||||
td:Chad
|
||||
cg:Congo-Brazzaville
|
||||
cd:Congo-Kinshasa
|
||||
ci:Côte d'Ivoire|Ivory Coast
|
||||
dj:Djibouti
|
||||
eg:Egypt
|
||||
gq:Equatorial Guinea
|
||||
er:Eritrea
|
||||
et:Ethiopia
|
||||
ga:Gabon
|
||||
gm:Gambia
|
||||
gh:Ghana
|
||||
gn:Guinea
|
||||
gw:Guinea-Bissau
|
||||
ke:Kenya
|
||||
lr:Liberia
|
||||
ly:Libya
|
||||
mw:Malawi
|
||||
ml:Mali
|
||||
mr:Mauritania
|
||||
ma:Morocco
|
||||
mz:Mozambique
|
||||
na:Namibia
|
||||
ne:Niger
|
||||
ng:Nigeria
|
||||
rw:Rwanda
|
||||
eh:Sahrawi
|
||||
sn:Senegal
|
||||
sl:Sierra Leone
|
||||
so:Somalia
|
||||
za:South Africa
|
||||
ss:South Sudan
|
||||
sd:Sudan
|
||||
sz:Swaziland
|
||||
tz:Tanzania
|
||||
tg:Togo
|
||||
tn:Tunisia
|
||||
ug:Uganda
|
||||
zm:Zambia
|
||||
zw:Zimbabwe
|
||||
Asia
|
||||
af:Afghanistan
|
||||
bd:Bangladesh
|
||||
bt:Bhutan
|
||||
bn:Brunei
|
||||
mm:Burma
|
||||
kh:Cambodia
|
||||
cn:China
|
||||
tl:East Timor
|
||||
in:India
|
||||
id:Indonesia
|
||||
jp:Japan
|
||||
kz:Kazakhstan
|
||||
kg:Kyrgyzstan
|
||||
la:Laos
|
||||
my:Malaysia
|
||||
mn:Mongolia
|
||||
np:Nepal
|
||||
kp:North Korea
|
||||
pk:Pakistan
|
||||
ph:Philippines
|
||||
sg:Singapore
|
||||
kr:South Korea
|
||||
lk:Sri Lanka
|
||||
tw:Taiwan
|
||||
tj:Tajikistan
|
||||
th:Thailand
|
||||
tm:Turkmenistan
|
||||
uz:Uzbekistan
|
||||
vn:Vietnam
|
||||
Central America
|
||||
bz:Belize
|
||||
cr:Costa Rica
|
||||
sv:El Salvador
|
||||
gt:Guatemala
|
||||
hn:Honduras
|
||||
ni:Nicaragua
|
||||
pa:Panama
|
||||
Europe
|
||||
al:Albania
|
||||
ad:Andorra
|
||||
am:Armenia
|
||||
at:Austria
|
||||
az:Azerbaijan
|
||||
by:Belarus
|
||||
be:Belgium
|
||||
ba:Bosnia and Herzegovina
|
||||
bg:Bulgaria
|
||||
hr:Croatia
|
||||
cz:Czech Republic
|
||||
dk:Denmark
|
||||
ee:Estonia
|
||||
fi:Finland
|
||||
fr:France
|
||||
All regions|France_Alsace|France_Aquitaine|France_Auvergne|France_Basse-Normandie|France_Bourgogne|France_Bretagne|France_Centre|France_Champagne-Ardenne|France_Corsica|France_Franche-Comte|France_Haute-Normandie|France_Languedoc-Roussillon|France_Limousin|France_Lorraine|France_Midi-Pyrenees|France_Nord-Pas-de-Calais|France_Paris & Ile-de-France|France_Pays de la Loire|France_Picardie|France_Poitou-Charentes|France_Provence-Alpes-Cote d'Azur|France_Rhone-Alpes
|
||||
fr:Alsace|France_Alsace
|
||||
fr:Aquitaine|France_Aquitaine
|
||||
fr:Auvergne|France_Auvergne
|
||||
fr:Basse-Normandie|France_Basse-Normandie
|
||||
fr:Bourgogne|France_Bourgogne
|
||||
fr:Bretagne|France_Bretagne
|
||||
fr:Centre|France_Centre
|
||||
fr:Champagne-Ardenne|France_Champagne-Ardenne
|
||||
fr:Corsica|France_Corsica
|
||||
fr:Franche-Comté|France_Franche-Comte
|
||||
fr:Haute-Normandie|France_Haute-Normandie
|
||||
fr:Languedoc-Roussillon|France_Languedoc-Roussillon
|
||||
fr:Limousin|France_Limousin
|
||||
fr:Lorraine|France_Lorraine
|
||||
fr:Midi-Pyrénées|France_Midi-Pyrenees
|
||||
fr:Nord-Pas-de-Calais|France_Nord-Pas-de-Calais
|
||||
fr:Paris & Île-de-France|France_Paris & Ile-de-France
|
||||
fr:Pays de la Loire|France_Pays de la Loire
|
||||
fr:Picardie|France_Picardie
|
||||
fr:Poitou-Charentes|France_Poitou-Charentes
|
||||
fr:Provence-Alpes-Côte d'Azur|France_Provence-Alpes-Cote d'Azur
|
||||
fr:Rhône-Alpes|France_Rhone-Alpes
|
||||
ge:Georgia
|
||||
de:Germany
|
||||
All states|Germany_Baden-Wurttemberg|Germany_Bavaria|Germany_Berlin & Brandenburg|Germany_Bremen & Lower Saxony|Germany_Hamburg|Germany_Hesse|Germany_Mecklenburg-Vorpommern|Germany_North Rhine-Westphalia|Germany_Rhineland-Palatinate|Germany_Saarland|Germany_Saxony-Anhalt|Germany_Saxony|Germany_Schleswig-Holstein|Germany_Thuringia
|
||||
de:Baden-Württemberg|Germany_Baden-Wurttemberg
|
||||
de:Bavaria|Germany_Bavaria
|
||||
de:Berlin & Brandenburg|Germany_Berlin & Brandenburg
|
||||
de:Bremen & Lower Saxony|Germany_Bremen & Lower Saxony
|
||||
de:Hamburg|Germany_Hamburg
|
||||
de:Hesse|Germany_Hesse
|
||||
de:Mecklenburg-Vorpommern|Germany_Mecklenburg-Vorpommern
|
||||
de:North Rhine-Westphalia|Germany_North Rhine-Westphalia
|
||||
de:Rhineland-Palatinate|Germany_Rhineland-Palatinate
|
||||
de:Saarland|Germany_Saarland
|
||||
de:Saxony-Anhalt|Germany_Saxony-Anhalt
|
||||
de:Saxony|Germany_Saxony
|
||||
de:Schleswig-Holstein|Germany_Schleswig-Holstein
|
||||
de:Thuringia|Germany_Thuringia
|
||||
gi:Gibraltar
|
||||
gr:Greece
|
||||
hu:Hungary
|
||||
is:Iceland
|
||||
ie:Ireland
|
||||
it:Italy
|
||||
xk:Kosovo
|
||||
lv:Latvia
|
||||
li:Liechtenstein
|
||||
lt:Lithuania
|
||||
lu:Luxembourg
|
||||
mk:Macedonia
|
||||
mt:Malta
|
||||
md:Moldova
|
||||
mc:Monaco
|
||||
me:Montenegro
|
||||
nl:Netherlands
|
||||
no:Norway
|
||||
pl:Poland
|
||||
pt:Portugal
|
||||
ro:Romania
|
||||
ru:Russia
|
||||
All federal districts|Russia_Central|Russia_Far Eastern|Russia_North Caucasian|Russia_Northwestern|Russia_Siberian|Russia_Southern|Russia_Urals|Russia_Volga
|
||||
ru:Moscow & Central|Russia_Central
|
||||
ru:Far Eastern|Russia_Far Eastern
|
||||
ru:North Caucasian|Russia_North Caucasian
|
||||
ru:Saint Petersburg & Northwestern|Russia_Northwestern
|
||||
ru:Siberian|Russia_Siberian
|
||||
ru:Southern|Russia_Southern
|
||||
ru:Urals|Russia_Urals
|
||||
ru:Volga|Russia_Volga
|
||||
rs:Serbia
|
||||
sk:Slovakia
|
||||
si:Slovenia
|
||||
es:Spain
|
||||
sj:Svalbard and Jan Mayen
|
||||
se:Sweden
|
||||
ch:Switzerland
|
||||
gb:UK and Crown Dependencies
|
||||
All UK territories|Guernsey|Isle of Man|Jersey|UK_England|UK_Northern Ireland|UK_Scotland|UK_Wales
|
||||
Guernsey
|
||||
Isle of Man
|
||||
Jersey
|
||||
uk_england:England|UK_England
|
||||
uk_northern_ireland:Northern Ireland|UK_Northern Ireland
|
||||
uk_scotland:Scotland|UK_Scotland
|
||||
uk_wales:Wales|UK_Wales
|
||||
ua:Ukraine
|
||||
Middle East
|
||||
bh:Bahrain
|
||||
cy:Cyprus
|
||||
ir:Iran
|
||||
iq:Iraq
|
||||
il:Israel
|
||||
jo:Jordan
|
||||
kw:Kuwait
|
||||
lb:Lebanon
|
||||
om:Oman
|
||||
ps:Palestine
|
||||
qa:Qatar
|
||||
sa:Saudi Arabia
|
||||
sy:Syria
|
||||
tr:Turkey
|
||||
ae:United Arab Emirates
|
||||
ye:Yemen
|
||||
Islands
|
||||
Atlantic Ocean
|
||||
bm:Bermuda
|
||||
bv:Bouvet Island
|
||||
cv:Cape Verde
|
||||
fk:Falkland Islands
|
||||
fo:Faroe Islands
|
||||
sh:Saint Helena, Ascension and Tristan da Cunha
|
||||
pm:Saint Pierre and Miquelon
|
||||
st:São Tomé and Príncipe|Sao Tome and Principe
|
||||
gs:South Georgia and the South Sandwich Islands
|
||||
Caribbean
|
||||
ai:Anguilla
|
||||
ag:Antigua and Barbuda
|
||||
aw:Aruba
|
||||
bs:Bahamas
|
||||
bb:Barbados
|
||||
vg:British Virgin Islands
|
||||
ky:Cayman Islands
|
||||
cu:Cuba
|
||||
cw:Curaçao|Curacao
|
||||
dm:Dominica
|
||||
do:Dominican Republic
|
||||
gd:Grenada
|
||||
gp:Guadeloupe
|
||||
ht:Haiti
|
||||
jm:Jamaica
|
||||
mq:Martinique
|
||||
ms:Montserrat
|
||||
an:Netherlands Antilles
|
||||
pr:Puerto Rico
|
||||
bl:Saint Barthélemy|Saint Barthelemy
|
||||
kn:Saint Kitts and Nevis
|
||||
lc:Saint Lucia
|
||||
vc:Saint Vincent and the Grenadines
|
||||
tt:Trinidad and Tobago
|
||||
tc:Turks and Caicos Islands
|
||||
vi:United States Virgin Islands
|
||||
Indian Ocean
|
||||
io:British Indian Ocean Territory
|
||||
km:Comoros
|
||||
tf:French Southern Territories
|
||||
hm:Heard Island and McDonald Islands
|
||||
mg:Madagascar
|
||||
mv:Maldives
|
||||
mu:Mauritius
|
||||
yt:Mayotte
|
||||
re:Réunion|Reunion
|
||||
sc:Seychelles
|
||||
North America
|
||||
ca:Canada
|
||||
All provinces and territories|Canada_Alberta|Canada_British Columbia|Canada_Manitoba|Canada_New Brunswick|Canada_Newfoundland and Labrador|Canada_Northwest Territories|Canada_Nova Scotia|Canada_Nunavut|Canada_Ontario|Canada_Prince Edward Island|Canada_Quebec|Canada_Saskatchewan|Canada_Yukon
|
||||
ca:Alberta|Canada_Alberta
|
||||
ca:British Columbia|Canada_British Columbia
|
||||
ca:Manitoba|Canada_Manitoba
|
||||
ca:New Brunswick|Canada_New Brunswick
|
||||
ca:Newfoundland and Labrador|Canada_Newfoundland and Labrador
|
||||
ca:Northwest Territories|Canada_Northwest Territories
|
||||
ca:Nova Scotia|Canada_Nova Scotia
|
||||
ca:Nunavut|Canada_Nunavut
|
||||
ca:Ontario|Canada_Ontario
|
||||
ca:Prince Edward Island|Canada_Prince Edward Island
|
||||
ca:Quebec|Canada_Quebec
|
||||
ca:Saskatchewan|Canada_Saskatchewan
|
||||
ca:Yukon|Canada_Yukon
|
||||
gl:Greenland
|
||||
mx:Mexico
|
||||
us:United States of America
|
||||
All states|USA_Alabama|USA_Alaska|USA_Arizona|USA_Arkansas|USA_California|USA_Colorado|USA_Connecticut|USA_Delaware|USA_District of Columbia|USA_Florida|USA_Georgia|USA_Hawaii|USA_Idaho|USA_Illinois|USA_Indiana|USA_Iowa|USA_Kansas|USA_Kentucky|USA_Louisiana|USA_Maine|USA_Maryland|USA_Massachusetts|USA_Michigan|USA_Minnesota|USA_Mississippi|USA_Missouri|USA_Montana|USA_Nebraska|USA_Nevada|USA_New Hampshire|USA_New Jersey|USA_New Mexico|USA_New York|USA_North Carolina|USA_North Dakota|USA_Ohio|USA_Oklahoma|USA_Oregon|USA_Pennsylvania|USA_Rhode Island|USA_South Carolina|USA_South Dakota|USA_Tennessee|USA_Texas|USA_Utah|USA_Vermont|USA_Virginia|USA_Washington|USA_West Virginia|USA_Wisconsin|USA_Wyoming
|
||||
us:Alabama|USA_Alabama
|
||||
us:Alaska|USA_Alaska
|
||||
us:Arizona|USA_Arizona
|
||||
us:Arkansas|USA_Arkansas
|
||||
us:California|USA_California
|
||||
us:Colorado|USA_Colorado
|
||||
us:Connecticut|USA_Connecticut
|
||||
us:Delaware|USA_Delaware
|
||||
us:District of Columbia|USA_District of Columbia
|
||||
us:Florida|USA_Florida
|
||||
us:Georgia|USA_Georgia
|
||||
us:Hawaii|USA_Hawaii
|
||||
us:Idaho|USA_Idaho
|
||||
us:Illinois|USA_Illinois
|
||||
us:Indiana|USA_Indiana
|
||||
us:Iowa|USA_Iowa
|
||||
us:Kansas|USA_Kansas
|
||||
us:Kentucky|USA_Kentucky
|
||||
us:Louisiana|USA_Louisiana
|
||||
us:Maine|USA_Maine
|
||||
us:Maryland|USA_Maryland
|
||||
us:Massachusetts|USA_Massachusetts
|
||||
us:Michigan|USA_Michigan
|
||||
us:Minnesota|USA_Minnesota
|
||||
us:Mississippi|USA_Mississippi
|
||||
us:Missouri|USA_Missouri
|
||||
us:Montana|USA_Montana
|
||||
us:Nebraska|USA_Nebraska
|
||||
us:Nevada|USA_Nevada
|
||||
us:New Hampshire|USA_New Hampshire
|
||||
us:New Jersey|USA_New Jersey
|
||||
us:New Mexico|USA_New Mexico
|
||||
us:New York|USA_New York
|
||||
us:North Carolina|USA_North Carolina
|
||||
us:North Dakota|USA_North Dakota
|
||||
us:Ohio|USA_Ohio
|
||||
us:Oklahoma|USA_Oklahoma
|
||||
us:Oregon|USA_Oregon
|
||||
us:Pennsylvania|USA_Pennsylvania
|
||||
us:Rhode Island|USA_Rhode Island
|
||||
us:South Carolina|USA_South Carolina
|
||||
us:South Dakota|USA_South Dakota
|
||||
us:Tennessee|USA_Tennessee
|
||||
us:Texas|USA_Texas
|
||||
us:Utah|USA_Utah
|
||||
us:Vermont|USA_Vermont
|
||||
us:Virginia|USA_Virginia
|
||||
us:Washington|USA_Washington
|
||||
us:West Virginia|USA_West Virginia
|
||||
us:Wisconsin|USA_Wisconsin
|
||||
us:Wyoming|USA_Wyoming
|
||||
Australia and Oceania
|
||||
as:American Samoa
|
||||
au:Australia
|
||||
cx:Christmas Island
|
||||
cc:Cocos Islands
|
||||
ck:Cook Islands
|
||||
fj:Fiji
|
||||
pf:French Polynesia
|
||||
gu:Guam
|
||||
ki:Kiribati
|
||||
mh:Marshall Islands
|
||||
fm:Micronesia
|
||||
nr:Nauru
|
||||
nc:New Caledonia
|
||||
nz:New Zealand
|
||||
nu:Niue
|
||||
nf:Norfolk Island
|
||||
mp:Northern Mariana Islands
|
||||
pw:Palau
|
||||
pg:Papua New Guinea
|
||||
pn:Pitcairn Islands
|
||||
ws:Samoa
|
||||
tk:Tokelau
|
||||
wf:Wallis and Futuna
|
||||
South America
|
||||
ar:Argentina
|
||||
bo:Bolivia
|
||||
br:Brazil
|
||||
cl:Chile
|
||||
co:Colombia
|
||||
ec:Ecuador
|
||||
gf:French Guiana
|
||||
gy:Guyana
|
||||
py:Paraguay
|
||||
pe:Peru
|
||||
sr:Suriname
|
||||
uy:Uruguay
|
||||
ve:Venezuela
|
||||
{
|
||||
"v":110925,
|
||||
"n":"World",
|
||||
"g":
|
||||
[
|
||||
{
|
||||
"n":"Africa",
|
||||
"g":
|
||||
[
|
||||
{"n":"Algeria","c":"dz","p":0,"s":5527914},
|
||||
{"n":"Angola","c":"ao","p":0,"s":1598903},
|
||||
{"n":"Benin","c":"bj","p":0,"s":394796},
|
||||
{"n":"Botswana","c":"bw","p":0,"s":1090631},
|
||||
{"n":"Burkina Faso","c":"bf","p":0,"s":969315},
|
||||
{"n":"Burundi","c":"bi","p":0,"s":803476},
|
||||
{"n":"Cameroon","c":"cm","p":0,"s":1633693},
|
||||
{"n":"Central African Republic","c":"cf","p":0,"s":658917},
|
||||
{"n":"Chad","c":"td","p":0,"s":513092},
|
||||
{"n":"Congo-Brazzaville","c":"cg","p":0,"s":965369},
|
||||
{"n":"Congo-Kinshasa","c":"cd","p":1,"s":10170093},
|
||||
{"n":"Côte d'Ivoire","c":"ci","f":"Ivory Coast","p":0,"s":2178205},
|
||||
{"n":"Djibouti","c":"dj","p":0,"s":148800},
|
||||
{"n":"Egypt","c":"eg","p":0,"s":8268109},
|
||||
{"n":"Equatorial Guinea","c":"gq","p":0,"s":182516},
|
||||
{"n":"Eritrea","c":"er","p":0,"s":468005},
|
||||
{"n":"Ethiopia","c":"et","p":0,"s":3547191},
|
||||
{"n":"Gabon","c":"ga","p":0,"s":1023120},
|
||||
{"n":"Gambia","c":"gm","p":0,"s":433830},
|
||||
{"n":"Ghana","c":"gh","p":0,"s":1067581},
|
||||
{"n":"Guinea","c":"gn","p":0,"s":1637326},
|
||||
{"n":"Guinea-Bissau","c":"gw","p":0,"s":1716563},
|
||||
{"n":"Kenya","c":"ke","p":0,"s":2414887},
|
||||
{"n":"Liberia","c":"lr","p":0,"s":637439},
|
||||
{"n":"Libya","c":"ly","p":0,"s":2414134},
|
||||
{"n":"Malawi","c":"mw","p":0,"s":2261580},
|
||||
{"n":"Mali","c":"ml","p":0,"s":1493222},
|
||||
{"n":"Mauritania","c":"mr","p":0,"s":441002},
|
||||
{"n":"Morocco","c":"ma","p":0,"s":3591113},
|
||||
{"n":"Mozambique","c":"mz","p":0,"s":2973971},
|
||||
{"n":"Namibia","c":"na","p":0,"s":2441564},
|
||||
{"n":"Niger","c":"ne","p":0,"s":1383143},
|
||||
{"n":"Nigeria","c":"ng","p":0,"s":5194980},
|
||||
{"n":"Rwanda","c":"rw","p":0,"s":470169},
|
||||
{"n":"Sahrawi","c":"eh","p":0,"s":215098},
|
||||
{"n":"Senegal","c":"sn","p":0,"s":1232482},
|
||||
{"n":"Sierra Leone","c":"sl","p":0,"s":1091510},
|
||||
{"n":"Somalia","c":"so","p":0,"s":925671},
|
||||
{"n":"South Africa","c":"za","p":1,"s":21655493},
|
||||
{"n":"South Sudan","c":"ss","p":0,"s":1403170},
|
||||
{"n":"Sudan","c":"sd","p":0,"s":2662254},
|
||||
{"n":"Swaziland","c":"sz","p":0,"s":217200},
|
||||
{"n":"Tanzania","c":"tz","p":0,"s":2807544},
|
||||
{"n":"Togo","c":"tg","p":0,"s":340585},
|
||||
{"n":"Tunisia","c":"tn","p":0,"s":3246026},
|
||||
{"n":"Uganda","c":"ug","p":0,"s":1299469},
|
||||
{"n":"Zambia","c":"zm","p":0,"s":1928096},
|
||||
{"n":"Zimbabwe","c":"zw","p":0,"s":1531513}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"Asia",
|
||||
"g":
|
||||
[
|
||||
{"n":"Afghanistan","c":"af","p":0,"s":3316726},
|
||||
{"n":"Bangladesh","c":"bd","p":0,"s":2875028},
|
||||
{"n":"Bhutan","c":"bt","p":0,"s":206508},
|
||||
{"n":"Brunei","c":"bn","p":0,"s":147277},
|
||||
{"n":"Burma","c":"mm","p":0,"s":3549640},
|
||||
{"n":"Cambodia","c":"kh","p":0,"s":941056},
|
||||
{"n":"China","c":"cn","p":1,"s":45126330},
|
||||
{"n":"East Timor","c":"tl","p":0,"s":248074},
|
||||
{"n":"India","c":"in","p":1,"s":37358404},
|
||||
{"n":"Indonesia","c":"id","p":1,"s":16256057},
|
||||
{"n":"Japan","c":"jp","p":3,"s":282680137},
|
||||
{"n":"Kazakhstan","c":"kz","p":0,"s":8027240},
|
||||
{"n":"Kyrgyzstan","c":"kg","p":0,"s":1748109},
|
||||
{"n":"Laos","c":"la","p":0,"s":2344434},
|
||||
{"n":"Malaysia","c":"my","p":0,"s":3237615},
|
||||
{"n":"Mongolia","c":"mn","p":0,"s":2318113},
|
||||
{"n":"Nepal","c":"np","p":0,"s":1241801},
|
||||
{"n":"North Korea","c":"kp","p":0,"s":3637391},
|
||||
{"n":"Pakistan","c":"pk","p":0,"s":6625387},
|
||||
{"n":"Philippines","c":"ph","p":1,"s":15671499},
|
||||
{"n":"Singapore","c":"sg","p":0,"s":1348373},
|
||||
{"n":"South Korea","c":"kr","p":1,"s":21776213},
|
||||
{"n":"Sri Lanka","c":"lk","p":0,"s":1263844},
|
||||
{"n":"Taiwan","c":"tw","p":0,"s":2715927},
|
||||
{"n":"Tajikistan","c":"tj","p":0,"s":1276232},
|
||||
{"n":"Thailand","c":"th","p":1,"s":12313988},
|
||||
{"n":"Turkmenistan","c":"tm","p":0,"s":805081},
|
||||
{"n":"Uzbekistan","c":"uz","p":0,"s":2562801},
|
||||
{"n":"Vietnam","c":"vn","p":0,"s":5810957},
|
||||
{"n":"Central America"},
|
||||
{"n":"Belize","c":"bz","p":0,"s":378608},
|
||||
{"n":"Costa Rica","c":"cr","p":0,"s":2556167},
|
||||
{"n":"El Salvador","c":"sv","p":0,"s":700327},
|
||||
{"n":"Guatemala","c":"gt","p":0,"s":2516406},
|
||||
{"n":"Honduras","c":"hn","p":0,"s":1680882},
|
||||
{"n":"Nicaragua","c":"ni","p":0,"s":1215937},
|
||||
{"n":"Panama","c":"pa","p":0,"s":1991759}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"Europe",
|
||||
"g":
|
||||
[
|
||||
{"n":"Albania","c":"al","p":0,"s":2274834},
|
||||
{"n":"Andorra","c":"ad","p":0,"s":187185},
|
||||
{"n":"Armenia","c":"am","p":0,"s":1202086},
|
||||
{"n":"Austria","c":"at","p":2,"s":82702776},
|
||||
{"n":"Azerbaijan","c":"az","p":0,"s":704461},
|
||||
{"n":"Belarus","c":"by","p":1,"s":39189876},
|
||||
{"n":"Belgium","c":"be","p":1,"s":45913751},
|
||||
{"n":"Bosnia and Herzegovina","c":"ba","p":0,"s":4618093},
|
||||
{"n":"Bulgaria","c":"bg","p":1,"s":13853975},
|
||||
{"n":"Croatia","c":"hr","p":1,"s":12656062},
|
||||
{"n":"Czech Republic","c":"cz","p":3,"s":112014305},
|
||||
{"n":"Denmark","c":"dk","p":1,"s":29574888},
|
||||
{"n":"Estonia","c":"ee","p":1,"s":37701465},
|
||||
{"n":"Finland","c":"fi","p":2,"s":99382855},
|
||||
{
|
||||
"n":"France",
|
||||
"c":"fr",
|
||||
"g":
|
||||
[
|
||||
{"n":"Alsace","c":"fr","p":1,"f":"France_Alsace","s":21983639},
|
||||
{"n":"Aquitaine","c":"fr","p":1,"f":"France_Aquitaine","s":41981433},
|
||||
{"n":"Auvergne","c":"fr","p":1,"f":"France_Auvergne","s":32232656},
|
||||
{"n":"Basse-Normandie","c":"fr","p":1,"f":"France_Basse-Normandie","s":15759594},
|
||||
{"n":"Bourgogne","c":"fr","p":1,"f":"France_Bourgogne","s":25884373},
|
||||
{"n":"Bretagne","c":"fr","p":2,"f":"France_Bretagne","s":66562695},
|
||||
{"n":"Centre","c":"fr","p":1,"f":"France_Centre","s":37366050},
|
||||
{"n":"Champagne-Ardenne","c":"fr","p":1,"f":"France_Champagne-Ardenne","s":19266776},
|
||||
{"n":"Corsica","c":"fr","p":0,"f":"France_Corsica","s":5405628},
|
||||
{"n":"Franche-Comté","c":"fr","p":1,"f":"France_Franche-Comte","s":20661060},
|
||||
{"n":"Haute-Normandie","c":"fr","p":1,"f":"France_Haute-Normandie","s":16659165},
|
||||
{"n":"Languedoc-Roussillon","c":"fr","p":1,"f":"France_Languedoc-Roussillon","s":42703839},
|
||||
{"n":"Limousin","c":"fr","p":1,"f":"France_Limousin","s":21336953},
|
||||
{"n":"Lorraine","c":"fr","p":1,"f":"France_Lorraine","s":26531903},
|
||||
{"n":"Midi-Pyrénées","c":"fr","p":2,"f":"France_Midi-Pyrenees","s":58727733},
|
||||
{"n":"Nord-Pas-de-Calais","c":"fr","p":1,"f":"France_Nord-Pas-de-Calais","s":40420110},
|
||||
{"n":"Paris & Île-de-France","c":"fr","p":2,"f":"France_Paris & Ile-de-France","s":55907943},
|
||||
{"n":"Pays de la Loire","c":"fr","p":2,"f":"France_Pays de la Loire","s":61940926},
|
||||
{"n":"Picardie","c":"fr","p":1,"f":"France_Picardie","s":15532623},
|
||||
{"n":"Poitou-Charentes","c":"fr","p":2,"f":"France_Poitou-Charentes","s":63414030},
|
||||
{"n":"Provence-Alpes-Côte d'Azur","c":"fr","p":2,"f":"France_Provence-Alpes-Cote d'Azur","s":59439343},
|
||||
{"n":"Rhône-Alpes","c":"fr","p":2,"f":"France_Rhone-Alpes","s":75313811}
|
||||
]
|
||||
},
|
||||
{"n":"Georgia","c":"ge","p":1,"s":12668877},
|
||||
{
|
||||
"n":"Germany",
|
||||
"c":"de",
|
||||
"g":
|
||||
[
|
||||
{"n":"Baden-Württemberg","c":"de","p":2,"f":"Germany_Baden-Wurttemberg","s":76470605},
|
||||
{"n":"Bavaria","c":"de","p":3,"f":"Germany_Bavaria","s":118653645},
|
||||
{"n":"Berlin & Brandenburg","c":"de","p":1,"f":"Germany_Berlin & Brandenburg","s":31400816},
|
||||
{"n":"Bremen & Lower Saxony","c":"de","p":2,"f":"Germany_Bremen & Lower Saxony","s":55699891},
|
||||
{"n":"Hamburg","c":"de","p":0,"f":"Germany_Hamburg","s":6651291},
|
||||
{"n":"Hesse","c":"de","p":1,"f":"Germany_Hesse","s":39638815},
|
||||
{"n":"Mecklenburg-Vorpommern","c":"de","p":1,"f":"Germany_Mecklenburg-Vorpommern","s":18019863},
|
||||
{"n":"North Rhine-Westphalia","c":"de","p":2,"f":"Germany_North Rhine-Westphalia","s":98850097},
|
||||
{"n":"Rhineland-Palatinate","c":"de","p":1,"f":"Germany_Rhineland-Palatinate","s":26663263},
|
||||
{"n":"Saarland","c":"de","p":0,"f":"Germany_Saarland","s":6023097},
|
||||
{"n":"Saxony-Anhalt","c":"de","p":1,"f":"Germany_Saxony-Anhalt","s":16183782},
|
||||
{"n":"Saxony","c":"de","p":1,"f":"Germany_Saxony","s":32321927},
|
||||
{"n":"Schleswig-Holstein","c":"de","p":1,"f":"Germany_Schleswig-Holstein","s":18192768},
|
||||
{"n":"Thuringia","c":"de","p":1,"f":"Germany_Thuringia","s":19254674}
|
||||
]
|
||||
},
|
||||
{"n":"Gibraltar","c":"gi","p":0,"s":34404},
|
||||
{"n":"Greece","c":"gr","p":1,"s":17802028},
|
||||
{"n":"Hungary","c":"hu","p":1,"s":21156567},
|
||||
{"n":"Iceland","c":"is","p":0,"s":5010148},
|
||||
{"n":"Ireland","c":"ie","p":1,"s":14961492},
|
||||
{"n":"Italy","c":"it","p":3,"s":162773348},
|
||||
{"n":"Kosovo","c":"xk","p":0,"s":6034908},
|
||||
{"n":"Latvia","c":"lv","p":1,"s":11523438},
|
||||
{"n":"Liechtenstein","c":"li","p":0,"s":191756},
|
||||
{"n":"Lithuania","c":"lt","p":1,"s":10461833},
|
||||
{"n":"Luxembourg","c":"lu","p":0,"s":4444625},
|
||||
{"n":"Macedonia","c":"mk","p":0,"s":3427780},
|
||||
{"n":"Malta","c":"mt","p":0,"s":440120},
|
||||
{"n":"Moldova","c":"md","p":0,"s":6919745},
|
||||
{"n":"Monaco","c":"mc","p":0,"s":56210},
|
||||
{"n":"Montenegro","c":"me","p":0,"s":1147138},
|
||||
{"n":"Netherlands","c":"nl","p":3,"s":257618532},
|
||||
{"n":"Norway","c":"no","p":2,"s":57025859},
|
||||
{"n":"Poland","c":"pl","p":2,"s":85438124},
|
||||
{"n":"Portugal","c":"pt","p":1,"s":13765332},
|
||||
{"n":"Romania","c":"ro","p":3,"s":115969358},
|
||||
{
|
||||
"n":"Russia",
|
||||
"c":"ru",
|
||||
"g":
|
||||
[
|
||||
{"n":"Moscow & Central","c":"ru","p":2,"f":"Russia_Central","s":84563519},
|
||||
{"n":"Far Eastern","c":"ru","p":1,"f":"Russia_Far Eastern","s":26263141},
|
||||
{"n":"North Caucasian","c":"ru","p":0,"f":"Russia_North Caucasian","s":5648802},
|
||||
{"n":"Saint Petersburg & Northwestern","c":"ru","p":2,"f":"Russia_Northwestern","s":84175427},
|
||||
{"n":"Siberian","c":"ru","p":1,"f":"Russia_Siberian","s":48722028},
|
||||
{"n":"Southern","c":"ru","p":1,"f":"Russia_Southern","s":28112771},
|
||||
{"n":"Urals","c":"ru","p":1,"f":"Russia_Urals","s":41348871},
|
||||
{"n":"Volga","c":"ru","p":2,"f":"Russia_Volga","s":72051817}
|
||||
]
|
||||
},
|
||||
{"n":"Serbia","c":"rs","p":1,"s":14651046},
|
||||
{"n":"Slovakia","c":"sk","p":2,"s":60479950},
|
||||
{"n":"Slovenia","c":"si","p":0,"s":7617354},
|
||||
{"n":"Spain","c":"es","p":3,"s":172096894},
|
||||
{"n":"Svalbard and Jan Mayen","c":"sj","p":0,"s":408439},
|
||||
{"n":"Sweden","c":"se","p":2,"s":75322188},
|
||||
{"n":"Switzerland","c":"ch","p":2,"s":52550905},
|
||||
{
|
||||
"n":"UK and Crown Dependencies",
|
||||
"c":"gb",
|
||||
"g":
|
||||
[
|
||||
{"n":"Guernsey","p":0,"s":160963},
|
||||
{"n":"Isle of Man","p":0,"s":792469},
|
||||
{"n":"Jersey","p":0,"s":84635},
|
||||
{"n":"England","c":"uk_england","p":3,"f":"UK_England","s":162382791},
|
||||
{"n":"Northern Ireland","c":"uk_northern_ireland","p":0,"f":"UK_Northern Ireland","s":2996169},
|
||||
{"n":"Scotland","c":"uk_scotland","p":1,"f":"UK_Scotland","s":25639137},
|
||||
{"n":"Wales","c":"uk_wales","p":1,"f":"UK_Wales","s":11807002}
|
||||
]
|
||||
},
|
||||
{"n":"Ukraine","c":"ua","p":1,"s":31375221}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"Middle East",
|
||||
"g":
|
||||
[
|
||||
{"n":"Bahrain","c":"bh","p":0,"s":385471},
|
||||
{"n":"Cyprus","c":"cy","p":0,"s":2405469},
|
||||
{"n":"Iran","c":"ir","p":0,"s":7223700},
|
||||
{"n":"Iraq","c":"iq","p":0,"s":2294117},
|
||||
{"n":"Israel","c":"il","p":0,"s":7800199},
|
||||
{"n":"Jordan","c":"jo","p":0,"s":1711518},
|
||||
{"n":"Kuwait","c":"kw","p":0,"s":355490},
|
||||
{"n":"Lebanon","c":"lb","p":0,"s":4177024},
|
||||
{"n":"Oman","c":"om","p":0,"s":1265916},
|
||||
{"n":"Palestine","c":"ps","p":0,"s":3127964},
|
||||
{"n":"Qatar","c":"qa","p":0,"s":265694},
|
||||
{"n":"Saudi Arabia","c":"sa","p":0,"s":5625890},
|
||||
{"n":"Syria","c":"sy","p":0,"s":3794528},
|
||||
{"n":"Turkey","c":"tr","p":1,"s":20008945},
|
||||
{"n":"United Arab Emirates","c":"ae","p":0,"s":2147167},
|
||||
{"n":"Yemen","c":"ye","p":0,"s":5920875}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"Islands",
|
||||
"g":
|
||||
[
|
||||
{
|
||||
"n":"Atlantic Ocean",
|
||||
"g":
|
||||
[
|
||||
{"n":"Bermuda","c":"bm","p":0,"s":56224},
|
||||
{"n":"Bouvet Island","c":"bv","p":0,"s":4023},
|
||||
{"n":"Cape Verde","c":"cv","p":0,"s":203812},
|
||||
{"n":"Falkland Islands","c":"fk","p":0,"s":742504},
|
||||
{"n":"Faroe Islands","c":"fo","p":0,"s":548457},
|
||||
{"n":"Saint Helena, Ascension and Tristan da Cunha","c":"sh","p":0,"s":85930},
|
||||
{"n":"Saint Pierre and Miquelon","c":"pm","p":0,"s":73771},
|
||||
{"n":"São Tomé and Príncipe","c":"st","p":0,"f":"Sao Tome and Principe","s":33539},
|
||||
{"n":"South Georgia and the South Sandwich Islands","c":"gs","p":0,"s":46528}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"Caribbean",
|
||||
"g":
|
||||
[
|
||||
{"n":"Anguilla","c":"ai","p":0,"s":34880},
|
||||
{"n":"Antigua and Barbuda","c":"ag","p":0,"s":192235},
|
||||
{"n":"Aruba","c":"aw","p":0,"s":253691},
|
||||
{"n":"Bahamas","c":"bs","p":0,"s":1744745},
|
||||
{"n":"Barbados","c":"bb","p":0,"s":271751},
|
||||
{"n":"British Virgin Islands","c":"vg","p":0,"s":98329},
|
||||
{"n":"Cayman Islands","c":"ky","p":0,"s":152808},
|
||||
{"n":"Cuba","c":"cu","p":0,"s":3771044},
|
||||
{"n":"Curaçao","c":"cw","p":0,"f":"Curacao","s":199512},
|
||||
{"n":"Dominica","c":"dm","p":0,"s":72477},
|
||||
{"n":"Dominican Republic","c":"do","p":0,"s":1878745},
|
||||
{"n":"Grenada","c":"gd","p":0,"s":172178},
|
||||
{"n":"Guadeloupe","c":"gp","p":0,"s":4607442},
|
||||
{"n":"Haiti","c":"ht","p":0,"s":6977061},
|
||||
{"n":"Jamaica","c":"jm","p":0,"s":544155},
|
||||
{"n":"Martinique","c":"mq","p":0,"s":2601529},
|
||||
{"n":"Montserrat","c":"ms","p":0,"s":27260},
|
||||
{"n":"Netherlands Antilles","c":"an","p":0,"s":142250},
|
||||
{"n":"Puerto Rico","c":"pr","p":0,"s":6852707},
|
||||
{"n":"Saint Barthélemy","c":"bl","p":0,"f":"Saint Barthelemy","s":73473},
|
||||
{"n":"Saint Kitts and Nevis","c":"kn","p":0,"s":68512},
|
||||
{"n":"Saint Lucia","c":"lc","p":0,"s":121428},
|
||||
{"n":"Saint Vincent and the Grenadines","c":"vc","p":0,"s":121487},
|
||||
{"n":"Trinidad and Tobago","c":"tt","p":0,"s":1291627},
|
||||
{"n":"Turks and Caicos Islands","c":"tc","p":0,"s":68909},
|
||||
{"n":"United States Virgin Islands","c":"vi","p":0,"s":346574}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"Indian Ocean",
|
||||
"g":
|
||||
[
|
||||
{"n":"British Indian Ocean Territory","c":"io","p":0,"s":30555},
|
||||
{"n":"Comoros","c":"km","p":0,"s":67863},
|
||||
{"n":"French Southern Territories","c":"tf","p":0,"s":323489},
|
||||
{"n":"Heard Island and McDonald Islands","c":"hm","p":0,"s":34791},
|
||||
{"n":"Madagascar","c":"mg","p":0,"s":4869408},
|
||||
{"n":"Maldives","c":"mv","p":0,"s":276011},
|
||||
{"n":"Mauritius","c":"mu","p":0,"s":233765},
|
||||
{"n":"Mayotte","c":"yt","p":0,"s":38386},
|
||||
{"n":"Réunion","c":"re","p":0,"f":"Reunion","s":4612456},
|
||||
{"n":"Seychelles","c":"sc","p":0,"s":133714}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"North America",
|
||||
"g":
|
||||
[
|
||||
{
|
||||
"n":"Canada",
|
||||
"c":"ca",
|
||||
"g":
|
||||
[
|
||||
{"n":"Alberta","c":"ca","p":1,"f":"Canada_Alberta","s":33587006},
|
||||
{"n":"British Columbia","c":"ca","p":2,"f":"Canada_British Columbia","s":98366641},
|
||||
{"n":"Manitoba","c":"ca","p":2,"f":"Canada_Manitoba","s":65613050},
|
||||
{"n":"New Brunswick","c":"ca","p":1,"f":"Canada_New Brunswick","s":19478899},
|
||||
{"n":"Newfoundland and Labrador","c":"ca","p":0,"f":"Canada_Newfoundland and Labrador","s":9444905},
|
||||
{"n":"Northwest Territories","c":"ca","p":1,"f":"Canada_Northwest Territories","s":30371988},
|
||||
{"n":"Nova Scotia","c":"ca","p":1,"f":"Canada_Nova Scotia","s":24727067},
|
||||
{"n":"Nunavut","c":"ca","p":1,"f":"Canada_Nunavut","s":33885120},
|
||||
{"n":"Ontario","c":"ca","p":3,"f":"Canada_Ontario","s":127132913},
|
||||
{"n":"Prince Edward Island","c":"ca","p":0,"f":"Canada_Prince Edward Island","s":552229},
|
||||
{"n":"Quebec","c":"ca","p":3,"f":"Canada_Quebec","s":156454185},
|
||||
{"n":"Saskatchewan","c":"ca","p":0,"f":"Canada_Saskatchewan","s":8535970},
|
||||
{"n":"Yukon","c":"ca","p":0,"f":"Canada_Yukon","s":1997991}
|
||||
]
|
||||
},
|
||||
{"n":"Greenland","c":"gl","p":0,"s":7421907},
|
||||
{"n":"Mexico","c":"mx","p":1,"s":19885679},
|
||||
{
|
||||
"n":"United States of America",
|
||||
"c":"us",
|
||||
"g":
|
||||
[
|
||||
{"n":"Alabama","c":"us","p":1,"f":"USA_Alabama","s":25751426},
|
||||
{"n":"Alaska","c":"us","p":1,"f":"USA_Alaska","s":16532115},
|
||||
{"n":"Arizona","c":"us","p":1,"f":"USA_Arizona","s":29290901},
|
||||
{"n":"Arkansas","c":"us","p":1,"f":"USA_Arkansas","s":17420416},
|
||||
{"n":"California","c":"us","p":3,"f":"USA_California","s":165890209},
|
||||
{"n":"Colorado","c":"us","p":1,"f":"USA_Colorado","s":49778111},
|
||||
{"n":"Connecticut","c":"us","p":0,"f":"USA_Connecticut","s":7193781},
|
||||
{"n":"Delaware","c":"us","p":0,"f":"USA_Delaware","s":2369847},
|
||||
{"n":"District of Columbia","c":"us","p":0,"f":"USA_District of Columbia","s":3699308},
|
||||
{"n":"Florida","c":"us","p":1,"f":"USA_Florida","s":46086595},
|
||||
{"n":"Georgia","c":"us","p":2,"f":"USA_Georgia","s":74487445},
|
||||
{"n":"Hawaii","c":"us","p":0,"f":"USA_Hawaii","s":4007460},
|
||||
{"n":"Idaho","c":"us","p":1,"f":"USA_Idaho","s":22268218},
|
||||
{"n":"Illinois","c":"us","p":1,"f":"USA_Illinois","s":35728857},
|
||||
{"n":"Indiana","c":"us","p":1,"f":"USA_Indiana","s":17271364},
|
||||
{"n":"Iowa","c":"us","p":1,"f":"USA_Iowa","s":28549402},
|
||||
{"n":"Kansas","c":"us","p":1,"f":"USA_Kansas","s":17152004},
|
||||
{"n":"Kentucky","c":"us","p":1,"f":"USA_Kentucky","s":20918855},
|
||||
{"n":"Louisiana","c":"us","p":1,"f":"USA_Louisiana","s":36295482},
|
||||
{"n":"Maine","c":"us","p":1,"f":"USA_Maine","s":12489698},
|
||||
{"n":"Maryland","c":"us","p":1,"f":"USA_Maryland","s":17757551},
|
||||
{"n":"Massachusetts","c":"us","p":1,"f":"USA_Massachusetts","s":33068937},
|
||||
{"n":"Michigan","c":"us","p":1,"f":"USA_Michigan","s":30644383},
|
||||
{"n":"Minnesota","c":"us","p":2,"f":"USA_Minnesota","s":62249339},
|
||||
{"n":"Mississippi","c":"us","p":1,"f":"USA_Mississippi","s":17949092},
|
||||
{"n":"Missouri","c":"us","p":1,"f":"USA_Missouri","s":30732160},
|
||||
{"n":"Montana","c":"us","p":1,"f":"USA_Montana","s":24625449},
|
||||
{"n":"Nebraska","c":"us","p":1,"f":"USA_Nebraska","s":14312984},
|
||||
{"n":"Nevada","c":"us","p":1,"f":"USA_Nevada","s":18492330},
|
||||
{"n":"New Hampshire","c":"us","p":1,"f":"USA_New Hampshire","s":11939497},
|
||||
{"n":"New Jersey","c":"us","p":1,"f":"USA_New Jersey","s":36461771},
|
||||
{"n":"New Mexico","c":"us","p":1,"f":"USA_New Mexico","s":23198121},
|
||||
{"n":"New York","c":"us","p":1,"f":"USA_New York","s":34046579},
|
||||
{"n":"North Carolina","c":"us","p":2,"f":"USA_North Carolina","s":83054255},
|
||||
{"n":"North Dakota","c":"us","p":1,"f":"USA_North Dakota","s":30661889},
|
||||
{"n":"Ohio","c":"us","p":1,"f":"USA_Ohio","s":29410147},
|
||||
{"n":"Oklahoma","c":"us","p":1,"f":"USA_Oklahoma","s":25887250},
|
||||
{"n":"Oregon","c":"us","p":1,"f":"USA_Oregon","s":35732381},
|
||||
{"n":"Pennsylvania","c":"us","p":1,"f":"USA_Pennsylvania","s":38959199},
|
||||
{"n":"Rhode Island","c":"us","p":0,"f":"USA_Rhode Island","s":2149095},
|
||||
{"n":"South Carolina","c":"us","p":1,"f":"USA_South Carolina","s":36520588},
|
||||
{"n":"South Dakota","c":"us","p":1,"f":"USA_South Dakota","s":10875032},
|
||||
{"n":"Tennessee","c":"us","p":1,"f":"USA_Tennessee","s":27004369},
|
||||
{"n":"Texas","c":"us","p":2,"f":"USA_Texas","s":83018545},
|
||||
{"n":"Utah","c":"us","p":1,"f":"USA_Utah","s":18339082},
|
||||
{"n":"Vermont","c":"us","p":0,"f":"USA_Vermont","s":6313519},
|
||||
{"n":"Virginia","c":"us","p":2,"f":"USA_Virginia","s":58704969},
|
||||
{"n":"Washington","c":"us","p":1,"f":"USA_Washington","s":34335096},
|
||||
{"n":"West Virginia","c":"us","p":1,"f":"USA_West Virginia","s":11958443},
|
||||
{"n":"Wisconsin","c":"us","p":1,"f":"USA_Wisconsin","s":34518161},
|
||||
{"n":"Wyoming","c":"us","p":1,"f":"USA_Wyoming","s":15303746}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"Australia and Oceania",
|
||||
"g":
|
||||
[
|
||||
{"n":"American Samoa","c":"as","p":0,"s":90138},
|
||||
{"n":"Australia","c":"au","p":2,"s":82507275},
|
||||
{"n":"Christmas Island","c":"cx","p":0,"s":14363},
|
||||
{"n":"Cocos Islands","c":"cc","p":0,"s":18136},
|
||||
{"n":"Cook Islands","c":"ck","p":0,"s":38698},
|
||||
{"n":"Fiji","c":"fj","p":0,"s":797331},
|
||||
{"n":"French Polynesia","c":"pf","p":0,"s":871808},
|
||||
{"n":"Guam","c":"gu","p":0,"s":355004},
|
||||
{"n":"Kiribati","c":"ki","p":0,"s":543468},
|
||||
{"n":"Marshall Islands","c":"mh","p":0,"s":414250},
|
||||
{"n":"Micronesia","c":"fm","p":0,"s":336558},
|
||||
{"n":"Nauru","c":"nr","p":0,"s":7730},
|
||||
{"n":"New Caledonia","c":"nc","p":0,"s":1485171},
|
||||
{"n":"New Zealand","c":"nz","p":1,"s":16248882},
|
||||
{"n":"Niue","c":"nu","p":0,"s":148519},
|
||||
{"n":"Norfolk Island","c":"nf","p":0,"s":15782},
|
||||
{"n":"Northern Mariana Islands","c":"mp","p":0,"s":179083},
|
||||
{"n":"Palau","c":"pw","p":0,"s":147775},
|
||||
{"n":"Papua New Guinea","c":"pg","p":0,"s":3011121},
|
||||
{"n":"Pitcairn Islands","c":"pn","p":0,"s":36874},
|
||||
{"n":"Samoa","c":"ws","p":0,"s":72634},
|
||||
{"n":"Tokelau","c":"tk","p":0,"s":14244},
|
||||
{"n":"Wallis and Futuna","c":"wf","p":0,"s":19991}
|
||||
]
|
||||
},
|
||||
{
|
||||
"n":"South America",
|
||||
"g":
|
||||
[
|
||||
{"n":"Argentina","c":"ar","p":1,"s":19748098},
|
||||
{"n":"Bolivia","c":"bo","p":0,"s":3816894},
|
||||
{"n":"Brazil","c":"br","p":1,"s":43743195},
|
||||
{"n":"Chile","c":"cl","p":1,"s":28154545},
|
||||
{"n":"Colombia","c":"co","p":1,"s":24436449},
|
||||
{"n":"Ecuador","c":"ec","p":0,"s":8304580},
|
||||
{"n":"French Guiana","c":"gf","p":0,"s":1595289},
|
||||
{"n":"Guyana","c":"gy","p":0,"s":865797},
|
||||
{"n":"Paraguay","c":"py","p":0,"s":940531},
|
||||
{"n":"Peru","c":"pe","p":1,"s":11803372},
|
||||
{"n":"Suriname","c":"sr","p":0,"s":526457},
|
||||
{"n":"Uruguay","c":"uy","p":0,"s":2544008},
|
||||
{"n":"Venezuela","c":"ve","p":0,"s":5952695}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -207,8 +207,8 @@ int main(int argc, char ** argv)
|
|||
// Create http update list for countries and corresponding files
|
||||
if (FLAGS_generate_update)
|
||||
{
|
||||
LOG(LINFO, ("Creating maps.update file..."));
|
||||
update::GenerateFilesList(path);
|
||||
LOG(LINFO, ("Updating countries file..."));
|
||||
update::UpdateCountries(path);
|
||||
}
|
||||
|
||||
if (!FLAGS_generate_borders.empty())
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Generator binary
|
||||
|
||||
ROOT_DIR = ../..
|
||||
DEPENDENCIES = generator storage indexer platform geometry coding base gflags expat sgitess version
|
||||
DEPENDENCIES = generator storage indexer platform geometry coding base gflags expat sgitess jansson version
|
||||
|
||||
include($$ROOT_DIR/common.pri)
|
||||
|
||||
|
|
|
@ -1,24 +1,22 @@
|
|||
#include "update_generator.hpp"
|
||||
|
||||
#include "../defines.hpp"
|
||||
|
||||
#include "../platform/platform.hpp"
|
||||
|
||||
#include "../storage/country.hpp"
|
||||
#include "../defines.hpp"
|
||||
|
||||
#include "../coding/file_writer.hpp"
|
||||
|
||||
#include "../base/string_utils.hpp"
|
||||
#include "../base/logging.hpp"
|
||||
#include "../base/macros.hpp"
|
||||
#include "../base/timer.hpp"
|
||||
|
||||
#include "../std/iterator.hpp"
|
||||
|
||||
|
||||
using namespace storage;
|
||||
|
||||
/// files which can be updated through downloader
|
||||
char const * gExtensionsToUpdate[] = {
|
||||
"*" DATA_FILE_EXTENSION, "*.txt", "*.bin", "*.skn", "*.ttf", "*.png"
|
||||
};
|
||||
|
||||
namespace update
|
||||
{
|
||||
// we don't support files without name or without extension
|
||||
|
@ -38,49 +36,76 @@ namespace update
|
|||
return true;
|
||||
}
|
||||
|
||||
bool GenerateFilesList(string const & dataDir)
|
||||
class SizeUpdater
|
||||
{
|
||||
Platform & platform = GetPlatform();
|
||||
size_t m_processedFiles;
|
||||
string m_dataDir;
|
||||
|
||||
Platform::FilesList files;
|
||||
for (size_t i = 0; i < ARRAY_SIZE(gExtensionsToUpdate); ++i)
|
||||
public:
|
||||
SizeUpdater(string const & dataDir) : m_processedFiles(0), m_dataDir(dataDir) {}
|
||||
~SizeUpdater()
|
||||
{
|
||||
Platform::FilesList otherFiles;
|
||||
platform.GetFilesInDir(dataDir, gExtensionsToUpdate[i], otherFiles);
|
||||
std::copy(otherFiles.begin(), otherFiles.end(), std::back_inserter(files));
|
||||
LOG(LINFO, (m_processedFiles, "file sizes were updated in the country list"));
|
||||
}
|
||||
template <class T>
|
||||
void operator()(T & c)
|
||||
{
|
||||
for (size_t i = 0; i < c.Value().m_files.size(); ++i)
|
||||
{
|
||||
++m_processedFiles;
|
||||
uint64_t size = 0;
|
||||
string const fname = c.Value().m_files[i].m_nameWithExt;
|
||||
if (!GetPlatform().GetFileSize(m_dataDir + fname, size))
|
||||
LOG(LERROR, ("File was not found:", fname));
|
||||
CHECK_GREATER(size, 0, ("Zero file size?", fname));
|
||||
c.Value().m_files[i].m_remoteSize = size;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
bool UpdateCountries(string const & dataDir)
|
||||
{
|
||||
Platform::FilesList mwmFiles;
|
||||
GetPlatform().GetFilesInDir(dataDir, "*" DATA_FILE_EXTENSION, mwmFiles);
|
||||
|
||||
// remove some files from list
|
||||
char const * filesToRemove[] = {"minsk-pass"DATA_FILE_EXTENSION,
|
||||
"World"DATA_FILE_EXTENSION,
|
||||
"WorldCoasts"DATA_FILE_EXTENSION};
|
||||
for (size_t i = 0; i < ARRAY_SIZE(filesToRemove); ++i)
|
||||
{
|
||||
Platform::FilesList::iterator found = std::find(mwmFiles.begin(), mwmFiles.end(),
|
||||
filesToRemove[i]);
|
||||
if (found != mwmFiles.end())
|
||||
mwmFiles.erase(found);
|
||||
}
|
||||
|
||||
{ // remove minsk-pass from list
|
||||
Platform::FilesList::iterator minskPassIt = std::find(files.begin(), files.end(), "minsk-pass" DATA_FILE_EXTENSION);
|
||||
if (minskPassIt != files.end())
|
||||
files.erase(minskPassIt);
|
||||
}
|
||||
|
||||
if (files.empty())
|
||||
if (mwmFiles.empty())
|
||||
{
|
||||
LOG(LERROR, ("Can't find any files at path", dataDir));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
LOG_SHORT(LINFO, (mwmFiles.size(), "mwm files were found"));
|
||||
|
||||
// load current countries information to update file sizes
|
||||
storage::CountriesContainerT countries;
|
||||
string jsonBuffer;
|
||||
ReaderPtr<Reader>(GetPlatform().GetReader(COUNTRIES_FILE)).ReadAsString(jsonBuffer);
|
||||
storage::LoadCountries(jsonBuffer, countries);
|
||||
{
|
||||
LOG_SHORT(LINFO, ("Files count included in update file:", files.size()));
|
||||
SizeUpdater sizeUpdater(dataDir);
|
||||
countries.ForEachChildren(sizeUpdater);
|
||||
}
|
||||
|
||||
CommonFilesT commonFiles;
|
||||
|
||||
for (Platform::FilesList::iterator it = files.begin(); it != files.end(); ++it)
|
||||
storage::SaveCountries(my::TodayAsYYMMDD(), countries, jsonBuffer);
|
||||
{
|
||||
uint64_t size = 0;
|
||||
CHECK( platform.GetFileSize(dataDir + *it, size), ());
|
||||
CHECK_EQUAL( size, static_cast<uint32_t>(size), ("We don't support files > 4gb", *it));
|
||||
|
||||
commonFiles.push_back(make_pair(*it, static_cast<uint32_t>(size)));
|
||||
string const outFileName = GetPlatform().WritablePathForFile(COUNTRIES_FILE".updated");
|
||||
FileWriter f(outFileName);
|
||||
f.Write(&jsonBuffer[0], jsonBuffer.size());
|
||||
LOG(LINFO, ("Saved updated countries to", outFileName));
|
||||
}
|
||||
|
||||
SaveFiles(dataDir + DATA_UPDATE_FILE, commonFiles);
|
||||
|
||||
LOG_SHORT(LINFO, ("Created update file with ", commonFiles.size(), " files"));
|
||||
|
||||
return true;
|
||||
}
|
||||
} // namespace update
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
namespace update
|
||||
{
|
||||
bool GenerateFilesList(string const & dataDir);
|
||||
bool UpdateCountries(string const & dataDir);
|
||||
} // namespace update
|
||||
|
|
|
@ -2,190 +2,178 @@
|
|||
|
||||
#include "../defines.hpp"
|
||||
|
||||
#include "../base/logging.hpp"
|
||||
|
||||
#include "../coding/file_container.hpp"
|
||||
|
||||
#include "../version/version.hpp"
|
||||
|
||||
#include "../platform/platform.hpp"
|
||||
|
||||
#include "../indexer/data_header.hpp"
|
||||
|
||||
#include "../coding/streams_sink.hpp"
|
||||
#include "../coding/file_reader.hpp"
|
||||
#include "../coding/file_writer.hpp"
|
||||
#include "../coding/file_container.hpp"
|
||||
|
||||
#include "../base/logging.hpp"
|
||||
#include "../base/std_serialization.hpp"
|
||||
#include "../base/string_utils.hpp"
|
||||
#include "../base/timer.hpp"
|
||||
|
||||
#include "../3party/jansson/myjansson.hpp"
|
||||
|
||||
namespace storage
|
||||
{
|
||||
/// Simple check - compare url size with real file size on disk
|
||||
bool IsFileDownloaded(CountryFile const & file)
|
||||
|
||||
/// Simple check - compare url size with real file size on disk
|
||||
bool IsFileDownloaded(CountryFile const & file)
|
||||
{
|
||||
uint64_t size = 0;
|
||||
if (!GetPlatform().GetFileSize(GetPlatform().WritablePathForFile(file.m_nameWithExt), size))
|
||||
return false;
|
||||
return true;//tile.second == size;
|
||||
}
|
||||
|
||||
struct CountryBoundsCalculator
|
||||
{
|
||||
m2::RectD & m_bounds;
|
||||
CountryBoundsCalculator(m2::RectD & bounds) : m_bounds(bounds) {}
|
||||
void operator()(CountryFile const & file)
|
||||
{
|
||||
uint64_t size = 0;
|
||||
if (!GetPlatform().GetFileSize(GetPlatform().WritablePathForFile(file.first), size))
|
||||
return false;
|
||||
return true;//tile.second == size;
|
||||
feature::DataHeader header;
|
||||
FilesContainerR reader(GetPlatform().WritablePathForFile(file.m_nameWithExt));
|
||||
header.Load(reader.GetReader(HEADER_FILE_TAG));
|
||||
m_bounds.Add(header.GetBounds());
|
||||
}
|
||||
};
|
||||
|
||||
struct CountryBoundsCalculator
|
||||
{
|
||||
m2::RectD & m_bounds;
|
||||
CountryBoundsCalculator(m2::RectD & bounds) : m_bounds(bounds) {}
|
||||
void operator()(CountryFile const & file)
|
||||
{
|
||||
feature::DataHeader header;
|
||||
FilesContainerR reader(GetPlatform().WritablePathForFile(file.first));
|
||||
header.Load(reader.GetReader(HEADER_FILE_TAG));
|
||||
m_bounds.Add(header.GetBounds());
|
||||
}
|
||||
};
|
||||
m2::RectD Country::Bounds() const
|
||||
{
|
||||
m2::RectD bounds;
|
||||
std::for_each(m_files.begin(), m_files.end(), CountryBoundsCalculator(bounds));
|
||||
return bounds;
|
||||
}
|
||||
|
||||
m2::RectD Country::Bounds() const
|
||||
LocalAndRemoteSizeT Country::Size() const
|
||||
{
|
||||
uint64_t localSize = 0, remoteSize = 0;
|
||||
for (FilesContainerT::const_iterator it = m_files.begin(); it != m_files.end(); ++it)
|
||||
{
|
||||
m2::RectD bounds;
|
||||
std::for_each(m_files.begin(), m_files.end(), CountryBoundsCalculator(bounds));
|
||||
return bounds;
|
||||
if (IsFileDownloaded(*it))
|
||||
localSize += it->m_remoteSize;
|
||||
remoteSize += it->m_remoteSize;
|
||||
}
|
||||
return LocalAndRemoteSizeT(localSize, remoteSize);
|
||||
}
|
||||
|
||||
struct SizeCalculator
|
||||
void Country::AddFile(CountryFile const & file)
|
||||
{
|
||||
m_files.push_back(file);
|
||||
}
|
||||
|
||||
int64_t Country::Price() const
|
||||
{
|
||||
int64_t price = 0;
|
||||
for (FilesContainerT::const_iterator it = m_files.begin(); it != m_files.end(); ++it)
|
||||
price += it->m_price;
|
||||
return price;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void LoadGroupImpl(int depth, json_t * group, CountriesContainerT & container)
|
||||
{
|
||||
for (size_t i = 0; i < json_array_size(group); ++i)
|
||||
{
|
||||
uint64_t & m_localSize;
|
||||
uint64_t & m_remoteSize;
|
||||
SizeCalculator(uint64_t & localSize, uint64_t & remoteSize)
|
||||
: m_localSize(localSize), m_remoteSize(remoteSize) {}
|
||||
void operator()(CountryFile const & file)
|
||||
{
|
||||
if (IsFileDownloaded(file))
|
||||
m_localSize += file.second;
|
||||
m_remoteSize += file.second;
|
||||
}
|
||||
};
|
||||
json_t * j = json_array_get(group, i);
|
||||
// name is mandatory
|
||||
char const * name = json_string_value(json_object_get(j, "n"));
|
||||
if (!name)
|
||||
MYTHROW(my::Json::Exception, ("Country name is missing"));
|
||||
// other fields are optional
|
||||
char const * flag = json_string_value(json_object_get(j, "c"));
|
||||
char const * file = json_string_value(json_object_get(j, "f"));
|
||||
// if file is empty, it's the same as the name
|
||||
if (!file)
|
||||
file = name;
|
||||
// price is valid only if size is not 0
|
||||
json_int_t size = json_integer_value(json_object_get(j, "s"));
|
||||
json_t * jPrice = json_object_get(j, "p");
|
||||
json_int_t price = jPrice ? json_integer_value(jPrice) : INVALID_PRICE;
|
||||
|
||||
LocalAndRemoteSizeT Country::Size() const
|
||||
{
|
||||
uint64_t localSize = 0;
|
||||
uint64_t remoteSize = 0;
|
||||
std::for_each(m_files.begin(), m_files.end(), SizeCalculator(localSize, remoteSize));
|
||||
return LocalAndRemoteSizeT(localSize, remoteSize);
|
||||
}
|
||||
Country country(name, flag ? flag : "");
|
||||
if (size)
|
||||
country.AddFile(CountryFile(string(file) + DATA_FILE_EXTENSION, size, price));
|
||||
container.AddAtDepth(depth, country);
|
||||
|
||||
void Country::AddFile(CountryFile const & file)
|
||||
{
|
||||
m_files.push_back(file);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool LoadCountries(file_t const & file, FilesContainerT const & sortedFiles,
|
||||
TCountriesContainer & countries)
|
||||
{
|
||||
countries.Clear();
|
||||
|
||||
string buffer;
|
||||
file.ReadAsString(buffer);
|
||||
istringstream stream(buffer);
|
||||
|
||||
std::string line;
|
||||
Country * currentCountry = &countries.Value();
|
||||
while (stream.good())
|
||||
{
|
||||
std::getline(stream, line);
|
||||
if (line.empty())
|
||||
continue;
|
||||
|
||||
// calculate spaces - depth inside the tree
|
||||
int spaces = 0;
|
||||
for (size_t i = 0; i < line.size(); ++i)
|
||||
{
|
||||
if (line[i] == ' ')
|
||||
++spaces;
|
||||
else
|
||||
break;
|
||||
}
|
||||
switch (spaces)
|
||||
{
|
||||
case 0:
|
||||
CHECK(false, ("We should never be here"));
|
||||
break;
|
||||
case 1: // country group
|
||||
case 2: // country name
|
||||
case 3: // region
|
||||
{
|
||||
line = line.substr(spaces);
|
||||
// country can have a defined flag in the beginning, like by:Belarus
|
||||
size_t const flagIndex = line.find(':');
|
||||
string flag;
|
||||
if (flagIndex != string::npos)
|
||||
{
|
||||
flag = line.substr(0, flagIndex);
|
||||
line = line.substr(flagIndex + 1);
|
||||
}
|
||||
strings::SimpleTokenizer tokIt(line, "|");
|
||||
// first string is country name, not always equal to country file name
|
||||
currentCountry = &countries.AddAtDepth(spaces - 1, Country(*tokIt, flag));
|
||||
// skip if > 1 names in the list - first name never corresponds to tile file
|
||||
if (!tokIt.IsLast())
|
||||
++tokIt;
|
||||
while (tokIt)
|
||||
{
|
||||
FilesContainerT::const_iterator const first = sortedFiles.begin();
|
||||
FilesContainerT::const_iterator const last = sortedFiles.end();
|
||||
string const nameWithExt = *tokIt + DATA_FILE_EXTENSION;
|
||||
FilesContainerT::const_iterator const found = lower_bound(
|
||||
first, last, CountryFile(nameWithExt, 0));
|
||||
if (found != last && !(nameWithExt < found->first))
|
||||
currentCountry->AddFile(*found);
|
||||
++tokIt;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return countries.SiblingsCount() > 0;
|
||||
}
|
||||
|
||||
void SaveFiles(string const & file, CommonFilesT const & commonFiles)
|
||||
{
|
||||
FileWriter writer(file);
|
||||
stream::SinkWriterStream<Writer> wStream(writer);
|
||||
|
||||
// save version - it's equal to current date in GMT
|
||||
wStream << my::TodayAsYYMMDD();
|
||||
wStream << commonFiles;
|
||||
}
|
||||
|
||||
bool LoadFiles(file_t const & file, FilesContainerT & files, uint32_t & dataVersion)
|
||||
{
|
||||
files.clear();
|
||||
|
||||
try
|
||||
{
|
||||
ReaderSource<file_t> source(file);
|
||||
stream::SinkReaderStream<ReaderSource<file_t> > stream(source);
|
||||
|
||||
CommonFilesT commonFiles;
|
||||
|
||||
stream >> dataVersion;
|
||||
stream >> commonFiles;
|
||||
|
||||
files.reserve(commonFiles.size());
|
||||
|
||||
for (CommonFilesT::iterator it = commonFiles.begin(); it != commonFiles.end(); ++it)
|
||||
files.push_back(CountryFile(it->first, it->second));
|
||||
|
||||
sort(files.begin(), files.end());
|
||||
}
|
||||
catch (RootException const & e)
|
||||
{
|
||||
LOG(LWARNING, ("Can't read tiles file", e.what()));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
json_t * children = json_object_get(j, "g");
|
||||
if (children)
|
||||
LoadGroupImpl(depth + 1, children, container);
|
||||
}
|
||||
}
|
||||
|
||||
int64_t LoadCountries(string const & jsonBuffer, CountriesContainerT & countries)
|
||||
{
|
||||
countries.Clear();
|
||||
|
||||
int64_t version = -1;
|
||||
|
||||
try
|
||||
{
|
||||
my::Json root(jsonBuffer.c_str());
|
||||
version = json_integer_value(json_object_get(root, "v"));
|
||||
json_t * children = json_object_get(root, "g");
|
||||
if (!children)
|
||||
MYTHROW(my::Json::Exception, ("Root country doesn't have any groups"));
|
||||
LoadGroupImpl(0, children, countries);
|
||||
}
|
||||
catch (my::Json::Exception const & e)
|
||||
{
|
||||
LOG(LERROR, (e.what()));
|
||||
return -1;
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void SaveImpl(T const & v, json_t * jParent)
|
||||
{
|
||||
size_t const siblingsCount = v.SiblingsCount();
|
||||
CHECK_GREATER(siblingsCount, 0, ());
|
||||
my::Json jArray(json_array());
|
||||
for (size_t i = 0; i < siblingsCount; ++i)
|
||||
{
|
||||
my::Json jCountry(json_object());
|
||||
string const strName = v[i].Value().Name();
|
||||
CHECK(!strName.empty(), ("Empty country name?"));
|
||||
json_object_set_new(jCountry, "n", json_string(strName.c_str()));
|
||||
string const strFlag = v[i].Value().Flag();
|
||||
if (!strFlag.empty())
|
||||
json_object_set_new(jCountry, "c", json_string(strFlag.c_str()));
|
||||
CHECK_LESS_OR_EQUAL(v[i].Value().Files().size(), 1, ("Not supporting more than 1 file for the country at the moment"));
|
||||
if (v[i].Value().Files().size())
|
||||
{
|
||||
int64_t const price = v[i].Value().Files()[0].m_price;
|
||||
CHECK_GREATER_OR_EQUAL(price, 0, ("Invalid price"));
|
||||
json_object_set_new(jCountry, "p", json_integer(price));
|
||||
string const strFile = v[i].Value().Files()[0].m_nameWithExt.substr(0,
|
||||
v[i].Value().Files()[0].m_nameWithExt.size() - string(DATA_FILE_EXTENSION).size());
|
||||
if (strFile != strName)
|
||||
json_object_set_new(jCountry, "f", json_string(strFile.c_str()));
|
||||
json_object_set_new(jCountry, "s", json_integer(v[i].Value().Files()[0].m_remoteSize));
|
||||
}
|
||||
if (v[i].SiblingsCount())
|
||||
SaveImpl(v[i], jCountry);
|
||||
|
||||
json_array_append(jArray, jCountry);
|
||||
}
|
||||
json_object_set(jParent, "g", jArray);
|
||||
}
|
||||
|
||||
bool SaveCountries(int64_t version, CountriesContainerT const & countries, string & jsonBuffer)
|
||||
{
|
||||
jsonBuffer.clear();
|
||||
my::Json root(json_object());
|
||||
json_object_set_new(root, "v", json_integer(version));
|
||||
json_object_set_new(root, "n", json_string("World"));
|
||||
SaveImpl(countries, root);
|
||||
char * res = json_dumps(root, JSON_PRESERVE_ORDER | JSON_COMPACT | JSON_INDENT(1));
|
||||
jsonBuffer = res;
|
||||
free(res);
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace storage
|
||||
|
|
|
@ -9,25 +9,31 @@
|
|||
#include "../std/string.hpp"
|
||||
#include "../std/vector.hpp"
|
||||
|
||||
template <class ReaderT> class ReaderPtr;
|
||||
class Reader;
|
||||
class Writer;
|
||||
namespace update { class SizeUpdater; }
|
||||
|
||||
namespace storage
|
||||
{
|
||||
/// holds file name for tile and it's total size
|
||||
typedef pair<string, uint32_t> CountryFile;
|
||||
static int64_t const INVALID_PRICE = -1;
|
||||
|
||||
/// Information about each file for a country
|
||||
struct CountryFile
|
||||
{
|
||||
CountryFile() : m_remoteSize(0), m_price(INVALID_PRICE) {}
|
||||
CountryFile(string const & fileNameWithExt, uint32_t remoteSize, int64_t price = -1)
|
||||
: m_nameWithExt(fileNameWithExt), m_remoteSize(remoteSize), m_price(price) {}
|
||||
string m_nameWithExt;
|
||||
uint32_t m_remoteSize;
|
||||
int64_t m_price;
|
||||
};
|
||||
typedef buffer_vector<CountryFile, 1> FilesContainerT;
|
||||
typedef pair<uint64_t, uint64_t> LocalAndRemoteSizeT;
|
||||
|
||||
/// Intermediate container for data transfer
|
||||
typedef vector<pair<string, uint32_t> > CommonFilesT;
|
||||
|
||||
bool IsFileDownloaded(CountryFile const & file);
|
||||
|
||||
/// Serves as a proxy between GUI and downloaded files
|
||||
class Country
|
||||
{
|
||||
friend class update::SizeUpdater;
|
||||
/// Name in the coutry node tree
|
||||
string m_name;
|
||||
/// Flag to display
|
||||
|
@ -47,19 +53,16 @@ namespace storage
|
|||
|
||||
string const & Name() const { return m_name; }
|
||||
string const & Flag() const { return m_flag; }
|
||||
int64_t Price() const;
|
||||
|
||||
/// @return bounds for downloaded parts of the country or empty rect
|
||||
m2::RectD Bounds() const;
|
||||
LocalAndRemoteSizeT Size() const;
|
||||
};
|
||||
|
||||
typedef SimpleTree<Country> TCountriesContainer;
|
||||
typedef SimpleTree<Country> CountriesContainerT;
|
||||
|
||||
/// @param tiles contains files and their sizes
|
||||
/// @return false if new application version should be downloaded
|
||||
typedef ReaderPtr<Reader> file_t;
|
||||
bool LoadCountries(file_t const & file, FilesContainerT const & sortedTiles,
|
||||
TCountriesContainer & countries);
|
||||
void SaveFiles(string const & file, CommonFilesT const & commonFiles);
|
||||
bool LoadFiles(file_t const & file, FilesContainerT & files, uint32_t & dataVersion);
|
||||
/// @return version of country file or -1 if error was encountered
|
||||
int64_t LoadCountries(string const & jsonBuffer, CountriesContainerT & countries);
|
||||
bool SaveCountries(int64_t version, CountriesContainerT const & countries, string & jsonBuffer);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace storage
|
|||
return UPDATE_BASE_URL OMIM_OS_NAME "/" + strings::to_string(m_currentVersion) + "/";
|
||||
}
|
||||
|
||||
TCountriesContainer const & NodeFromIndex(TCountriesContainer const & root, TIndex const & index)
|
||||
CountriesContainerT const & NodeFromIndex(CountriesContainerT const & root, TIndex const & index)
|
||||
{
|
||||
// complex logic to avoid [] out_of_bounds exceptions
|
||||
if (index.m_group == TIndex::INVALID || index.m_group >= static_cast<int>(root.SiblingsCount()))
|
||||
|
@ -172,9 +172,9 @@ namespace storage
|
|||
{
|
||||
m_workingDir = GetPlatform().WritableDir();
|
||||
}
|
||||
void operator()(CountryFile const & tile)
|
||||
void operator()(CountryFile const & file)
|
||||
{
|
||||
m_removeFn(tile.first);
|
||||
m_removeFn(file.m_nameWithExt);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -189,8 +189,8 @@ namespace storage
|
|||
if (!IsFileDownloaded(*it))
|
||||
{
|
||||
HttpStartParams params;
|
||||
params.m_url = UpdateBaseUrl() + UrlEncode(it->first);
|
||||
params.m_fileToSave = GetPlatform().WritablePathForFile(it->first);
|
||||
params.m_url = UpdateBaseUrl() + UrlEncode(it->m_nameWithExt);
|
||||
params.m_fileToSave = GetPlatform().WritablePathForFile(it->m_nameWithExt);
|
||||
params.m_finish = bind(&Storage::OnMapDownloadFinished, this, _1);
|
||||
params.m_progress = bind(&Storage::OnMapDownloadProgress, this, _1);
|
||||
params.m_useResume = true; // enabled resume support by default
|
||||
|
@ -219,9 +219,9 @@ namespace storage
|
|||
{
|
||||
string const m_baseUrl;
|
||||
CancelDownloading(string const & baseUrl) : m_baseUrl(baseUrl) {}
|
||||
void operator()(CountryFile const & tile)
|
||||
void operator()(CountryFile const & file)
|
||||
{
|
||||
GetDownloadManager().CancelDownload((m_baseUrl + UrlEncode(tile.first)).c_str());
|
||||
GetDownloadManager().CancelDownload((m_baseUrl + UrlEncode(file.m_nameWithExt)).c_str());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -234,9 +234,9 @@ namespace storage
|
|||
m_workingDir = GetPlatform().WritableDir();
|
||||
}
|
||||
/// @TODO do not delete other countries cells
|
||||
void operator()(CountryFile const & tile)
|
||||
void operator()(CountryFile const & file)
|
||||
{
|
||||
FileWriter::DeleteFileX(m_workingDir + tile.first);
|
||||
FileWriter::DeleteFileX(m_workingDir + file.m_nameWithExt);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -299,19 +299,11 @@ namespace storage
|
|||
|
||||
if (m_countries.SiblingsCount() == 0)
|
||||
{
|
||||
Platform & pl = GetPlatform();
|
||||
FilesContainerT tiles;
|
||||
if (LoadFiles(pl.GetReader(DATA_UPDATE_FILE), tiles, m_currentVersion))
|
||||
{
|
||||
if (!LoadCountries(pl.GetReader(COUNTRIES_FILE), tiles, m_countries))
|
||||
{
|
||||
LOG(LWARNING, ("Can't load countries file", COUNTRIES_FILE));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(LWARNING, ("Can't load update file", DATA_UPDATE_FILE));
|
||||
}
|
||||
string json;
|
||||
ReaderPtr<Reader>(GetPlatform().GetReader(COUNTRIES_FILE)).ReadAsString(json);
|
||||
m_currentVersion = LoadCountries(json, m_countries);
|
||||
if (m_currentVersion < 0)
|
||||
LOG(LERROR, ("Can't load countries file", COUNTRIES_FILE));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,9 +63,9 @@ namespace storage
|
|||
class Storage
|
||||
{
|
||||
/// stores timestamp for update checks
|
||||
uint32_t m_currentVersion;
|
||||
int64_t m_currentVersion;
|
||||
|
||||
TCountriesContainer m_countries;
|
||||
CountriesContainerT m_countries;
|
||||
|
||||
typedef list<TIndex> TQueue;
|
||||
TQueue m_queue;
|
||||
|
|
|
@ -6,10 +6,12 @@ CONFIG += staticlib
|
|||
|
||||
ROOT_DIR = ..
|
||||
|
||||
DEPENDENCIES = indexer geometry coding base
|
||||
DEPENDENCIES = indexer geometry coding base jansson
|
||||
|
||||
include($$ROOT_DIR/common.pri)
|
||||
|
||||
INCLUDEPATH += $$ROOT_DIR/3party/jansson/src
|
||||
|
||||
HEADERS += \
|
||||
country.hpp \
|
||||
simple_tree.hpp \
|
||||
|
|
|
@ -9,29 +9,3 @@
|
|||
|
||||
using namespace storage;
|
||||
|
||||
UNIT_TEST(FilesSerialization)
|
||||
{
|
||||
static string const FILE = "tiles_serialization_test";
|
||||
CommonFilesT::value_type const vv1("str2", 456);
|
||||
CommonFilesT::value_type const vv2("str1", 123);
|
||||
{
|
||||
CommonFilesT commonFiles;
|
||||
commonFiles.push_back(vv1);
|
||||
commonFiles.push_back(vv2);
|
||||
|
||||
SaveFiles(FILE, commonFiles);
|
||||
}
|
||||
|
||||
{
|
||||
uint32_t version;
|
||||
|
||||
FilesContainerT files;
|
||||
TEST(LoadFiles(ReaderPtr<Reader>(new FileReader(FILE)), files, version), ());
|
||||
|
||||
TEST_EQUAL( files.size(), 2, ());
|
||||
TEST_EQUAL( files[0], FilesContainerT::value_type("str1", 123), ());
|
||||
TEST_EQUAL( files[1], FilesContainerT::value_type("str2", 456), ());
|
||||
}
|
||||
|
||||
FileWriter::DeleteFileX(FILE);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue