From 01b19f11ad19d60ca71f09bdb1e7f6d3b1826027 Mon Sep 17 00:00:00 2001 From: Dale Harvey Date: Thu, 11 Jun 2020 07:11:00 +0000 Subject: [PATCH] Bug 1627560 - Implement local geocoding r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D78611 --- toolkit/modules/Region.jsm | 169 ++++++++++++++++++ .../xpcshell/regions/world-buffered.geojson | 10 ++ .../tests/xpcshell/regions/world.geojson | 10 ++ .../tests/xpcshell/test_Region_geocoding.js | 52 ++++++ toolkit/modules/tests/xpcshell/xpcshell.ini | 3 + 5 files changed, 244 insertions(+) create mode 100644 toolkit/modules/tests/xpcshell/regions/world-buffered.geojson create mode 100644 toolkit/modules/tests/xpcshell/regions/world.geojson create mode 100644 toolkit/modules/tests/xpcshell/test_Region_geocoding.js diff --git a/toolkit/modules/Region.jsm b/toolkit/modules/Region.jsm index ded765776cd2..8b18986b9edd 100644 --- a/toolkit/modules/Region.jsm +++ b/toolkit/modules/Region.jsm @@ -264,6 +264,175 @@ class RegionDetector { return result; } + /** + * Return the users current region using + * request that is used for GeoLocation requests. + * + * @returns {String} + * A 2 character string representing a region. + */ + async _getRegionLocally() { + let { location } = await this._getLocation(); + return this._geoCode(location); + } + + // TODO: Stubs for testing + async _getPlainMap() { + return null; + } + async _getBufferedMap() { + return null; + } + + /** + * Take a location and return the region code for that location + * by looking up the coordinates in geojson map files. + * Inspired by https://github.com/mozilla/ichnaea/blob/874e8284f0dfa1868e79aae64e14707eed660efe/ichnaea/geocode.py#L114 + * + * @param {Object} location + * A location object containing lat + lng coordinates. + * + * @returns {String} + * A 2 character string representing a region. + */ + async _geoCode(location) { + let plainMap = await this._getPlainMap(); + let polygons = this._getPolygonsContainingPoint(location, plainMap); + // The plain map doesnt have overlapping regions so return + // region straight away. + if (polygons.length) { + return polygons[0].region; + } + let bufferedMap = await this._getBufferedMap(); + polygons = this._getPolygonsContainingPoint(location, bufferedMap); + // Only found one matching region, return. + if (polygons.length === 1) { + return polygons[0].region; + } + // Matched more than one region, find the longest distance + // from a border and return that region. + if (polygons.length > 1) { + return this._findLargestDistance(location, polygons); + } + return null; + } + + /** + * Find all the polygons that contain a single point, return + * an array of those polygons along with the region that + * they define + * + * @param {Object} point + * A lat + lng coordinate. + * @param {Object} map + * Geojson object that defined seperate regions with a list + * of polygons. + * + * @returns {Array} + * An array of polygons that contain the point, along with the + * region they define. + */ + _getPolygonsContainingPoint(point, map) { + let polygons = []; + for (const feature of map.features) { + let coords = feature.geometry.coordinates; + if (feature.geometry.type === "Polygon") { + if (this._polygonInPoint(point, coords[0])) { + polygons.push({ + coords: coords[0], + region: feature.properties.alpha2, + }); + } + } else if (feature.geometry.type === "MultiPolygon") { + for (const innerCoords of coords) { + if (this._polygonInPoint(point, innerCoords[0])) { + polygons.push({ + coords: innerCoords[0], + region: feature.properties.alpha2, + }); + } + } + } + } + return polygons; + } + + /** + * Find the largest distance between a point and and a border + * that contains it. + * + * @param {Object} location + * A lat + lng coordinate. + * @param {Object} polygons + * Array of polygons that define a border. + * + * @returns {String} + * A 2 character string representing a region. + */ + _findLargestDistance(location, polygons) { + let maxDistance = { distance: 0, region: null }; + for (const polygon of polygons) { + for (const [lng, lat] of polygon.coords) { + let distance = this._distanceBetween(location, { lng, lat }); + if (distance > maxDistance.distance) { + maxDistance = { distance, region: polygon.region }; + } + } + } + return maxDistance.region; + } + + /** + * Check whether a point is contained within a polygon using the + * point in polygon algorithm: + * https://en.wikipedia.org/wiki/Point_in_polygon + * This casts a ray from the point and counts how many times + * that ray intersects with the polygons borders, if it is + * an odd number of times the point is inside the polygon. + * + * @param {Object} location + * A lat + lng coordinate. + * @param {Object} polygon + * Array of coordinates that define the boundaries of a polygon. + * + * @returns {boolean} + * Whether the point is within the polygon. + */ + _polygonInPoint({ lng, lat }, poly) { + let inside = false; + // For each edge of the polygon. + for (let i = 0, j = poly.length - 1; i < poly.length; j = i++) { + let xi = poly[i][0]; + let yi = poly[i][1]; + let xj = poly[j][0]; + let yj = poly[j][1]; + // Does a ray cast from the point intersect with this polygon edge. + let intersect = + yi > lat != yj > lat && lng < ((xj - xi) * (lat - yi)) / (yj - yi) + xi; + // If so toggle result, an odd number of intersections + // means the point is inside. + if (intersect) { + inside = !inside; + } + } + return inside; + } + + /** + * Find the distance between 2 points. + * + * @param {Object} p1 + * A lat + lng coordinate. + * @param {Object} p2 + * A lat + lng coordinate. + * + * @returns {int} + * The distance between the 2 points. + */ + _distanceBetween(p1, p2) { + return Math.hypot(p2.lng - p1.lng, p2.lat - p1.lat); + } + /** * A wrapper around fetch that implements a timeout, will throw * a TIMEOUT error if the request is not completed in time. diff --git a/toolkit/modules/tests/xpcshell/regions/world-buffered.geojson b/toolkit/modules/tests/xpcshell/regions/world-buffered.geojson new file mode 100644 index 000000000000..aff9a38f42cd --- /dev/null +++ b/toolkit/modules/tests/xpcshell/regions/world-buffered.geojson @@ -0,0 +1,10 @@ +{"type": "FeatureCollection", "features": [ +{"geometry":{"coordinates":[[[15.439536204494244,44.363945709333983],[15.280496200501087,44.561636241873558],[15.238967198634207,44.81193728368094],[15.343861312882128,45.345623143896788],[15.403820621321374,45.475176229009875],[15.49794607373167,45.582505254624529],[15.618564894354259,45.658861136142896],[15.755844661254125,45.698019610714191],[16.097445289413301,45.685707913818277],[16.255198064412845,45.633626128916987],[16.422163935585388,45.704523126436015],[16.666310914885635,45.709603554720651],[16.836360826251511,45.769448006473553],[16.978669062604407,45.772655053110213],[17.312723193761428,45.651122232203761],[18.29795614168874,45.633840547750701],[18.73691642039282,45.571632686740365],[18.88283163861837,45.52604554616741],[19.085717327546913,45.381501326494352],[19.374402721442532,45.393356133717241],[19.562025857333108,45.33053592217199],[19.723491004191121,45.198172738341484],[19.828515955696108,45.023603751859973],[19.84878554088786,44.770763093621127],[19.763855798394342,44.526245517404718],[20.002958119163413,44.315554116748025],[20.06386369711894,44.182269065671896],[20.080494253170805,43.98813969739615],[19.98321936441295,43.742057341847115],[19.968197077515288,43.480734044792705],[19.831743418227305,43.238001199571109],[19.679992469715817,43.117727457446783],[19.470254965260473,43.063255412350372],[19.296107565487837,42.871578367247643],[19.064701473384666,42.79431305439104],[19.023012979033709,42.728208020476416],[19.033473158632322,42.583895441391633],[19.003218274258607,42.445379854564514],[18.935298707932422,42.320925612641673],[18.835175715990516,42.22053979538083],[18.613896673777976,42.092530355737658],[18.384758472225201,42.062605402433469],[18.116310424795401,42.136452989426672],[17.59420709094379,42.417350393502907],[17.27773557896057,42.544377117489582],[17.176443726933787,42.650844841576912],[17.104120658760888,42.805236583476685],[16.927578439890446,42.964713358208179],[16.834259723326429,43.105552275336066],[16.396603961925315,43.392534089742064],[15.984041728167199,43.737017435767712],[15.792224958431737,43.947390938908583],[15.693505026483598,44.176116329187124],[15.439536204494244,44.363945709333983]]],"type":"Polygon"},"properties":{"alpha2":"BA"},"type":"Feature"}, +{"geometry":{"coordinates":[[[[-8.4618641677579287,54.067082761868029],[-8.5624705748737444,54.179014777871608],[-8.6366175468823236,54.364841524950961],[-8.6319738910057282,54.564860998623487],[-8.5492831374123472,54.747046598104603],[-8.3619389605922585,54.906135221270929],[-8.2007019401366286,55.104664370231667],[-8.06444920876827,55.174935451802781],[-7.8436975694055144,55.226910608391016],[-7.6456384913710211,55.448231420188925],[-7.406195161339963,55.555219969304744],[-6.9920659635713571,55.680731874092601],[-6.9622283806738068,55.873980273417565],[-6.8525592474036321,56.121023190682315],[-7.0702599533960804,56.29019837846765],[-7.1628959497422615,56.535298560823712],[-7.3602965148327337,56.46891130801599],[-7.5824377658096989,56.466216817192539],[-7.7233418978398998,56.499410270396879],[-7.9186522261913783,56.638475043535315],[-8.0267682223336543,56.852475199766495],[-8.0228296355197433,57.092203427188124],[-7.9114581717658101,57.31061966632388],[-8.0086071943725745,57.533946356514313],[-7.9903864085317338,57.771796791867132],[-7.9262109205368878,57.900727216599975],[-7.8279478580921964,58.006016903845023],[-7.57999485626401,58.112629231697781],[-7.5550138448801691,58.352689504118686],[-7.4167465033025266,58.556144099127089],[-7.292164307301479,58.63709630319125],[-7.0745309810355383,58.697769861000346],[-6.9111384187795704,58.79190314919439],[-6.3602432586735258,58.987248995255968],[-6.2163725967235148,59.002099794431338],[-6.0742705630289242,58.975149365382016],[-5.9079576423375322,58.878573286249726],[-5.7904010751814781,58.726364941642892],[-5.7309442789875513,58.546946302466864],[-5.6487129220282135,58.630337112786719],[-5.4994395253141981,58.712145115920045],[-5.3512576544490429,58.937795114601002],[-5.1743770799372779,59.040759200558824],[-4.9399768530096448,59.087328263690665],[-4.6628402137013243,59.041630595398338],[-4.5046250058647468,59.068028063926015],[-4.3096998242779749,59.035876825681846],[-3.8624604570901697,59.084251878293635],[-3.7572894536990802,59.354483997871945],[-3.6690241428974568,59.478825219230686],[-3.229105999409934,59.797331916732197],[-2.9704290800649988,59.846854081295241],[-2.6751909128648195,59.759823424314611],[-2.3447162991499311,59.793418409060479],[-2.1623231114191959,59.733167991697208],[-1.9878994368171214,59.569385152489254],[-1.9163024287659969,59.391140219430397],[-1.9171907636114731,59.19905534604306],[-1.9657578613076891,59.063005251973351],[-2.0511929322522691,58.946518172313397],[-2.2865628174449606,58.805043211080694],[-2.3586928226784774,58.661280299319522],[-2.594930298279027,58.391704722720846],[-2.676618715041255,58.184426656861753],[-1.9989980166027435,58.196529256334905],[-1.6594930671030157,58.064235269022298],[-1.5351466623511123,57.984558437574805],[-1.4395002084098525,57.872032077584365],[-1.3123849628169215,57.648845375132161],[-1.2817055852779997,57.503132946679258],[-1.3095717981639623,57.307136454661588],[-1.3796484023416129,57.175749219517733],[-1.6252315148977277,56.941750181740218],[-1.8585286027542449,56.566004195598047],[-2.0324418241270874,56.389857164881413],[-1.8669491460459531,56.316895936118271],[-1.2702010067062686,55.888718968266602],[-0.88895773952517754,55.111115216939027],[-0.44913410642613116,54.951474301223364],[0.26565171773657464,54.474686673856461],[0.3919363789101184,54.268912582211364],[0.40868987804856216,54.040078260928944],[0.53281829875049969,53.883989295570707],[0.60433767192729249,53.70943237817945],[0.76827608114165269,53.455599518392098],[1.3841301167582487,53.411216925997422],[1.9920251097423427,53.123310456642798],[2.1886023028220136,52.839809973444879],[2.2415892574960319,52.400063387011834],[2.0270354115958424,51.874782920667535],[1.9413594383319945,51.762945516892927],[1.8117225755737223,51.666023612827914],[1.8912223137796473,51.514535291061499],[1.9146995984240194,51.36572952326442],[1.887861348550544,51.085133266781298],[1.8375012301939089,50.94491201187315],[1.6705193395397111,50.763350820206618],[1.3642468448710579,50.630870569064228],[1.2399513453152329,50.511814882086469],[1.105903430714914,50.447859992391095],[0.8508684942433683,50.426326077428733],[0.35790672089165232,50.279687188505086],[-0.22206923791433586,50.313069834915474],[-0.7845399140098962,50.280890838809192],[-1.048357148647012,50.132140780710621],[-1.1983624297605657,50.091850770984806],[-1.3534939378053827,50.099537412475293],[-1.7156762242637884,50.212492505359123],[-1.950193382149682,50.110821390232836],[-2.2768101485492358,50.125970866671111],[-2.446268676871945,50.100048145427365],[-2.9616952107332861,50.211381426947327],[-3.0896824225292621,50.17963339496351],[-3.259076692736234,49.942377191300118],[-3.4384715456678308,49.802337217699751],[-3.5822431121972356,49.749819478371712],[-3.8490390436482973,49.732600600998943],[-4.2697033251262795,49.859725856612251],[-4.5897482941419758,49.804166836692467],[-4.7072390396476882,49.749090891437042],[-4.8564869503241281,49.612782238411199],[-4.9920930928674352,49.554826596774632],[-5.2506366641728874,49.52230677417861],[-5.4610808027531954,49.576411493093318],[-5.6830188700633535,49.554698681803686],[-5.9043455932770694,49.638263278481503],[-6.0378891185056771,49.77329224440463],[-6.1465344059416953,50.034788566458595],[-6.1450694970520106,50.235904750038927],[-6.064478551400029,50.420173479710812],[-5.9595199883050221,50.529139157023074],[-5.7966610286660485,50.641845588372995],[-5.5279687561215258,50.724756716002659],[-5.0225987355821209,51.079854635385843],[-4.9985452497525751,51.136440158871785],[-5.3362697672481936,51.253137783443378],[-5.486640076669981,51.361261467551905],[-5.7069382428112005,51.65220779586533],[-5.7619038440519823,51.886580368187701],[-5.7221332729552659,52.075715942265091],[-5.6136032104506493,52.23563838984419],[-5.3209836270746971,52.4379549508566],[-5.0891084325324121,52.515990202879337],[-5.1622017134504645,52.664349303293186],[-5.1803738557708714,52.855691967283583],[-5.1250212438685736,53.03975263710484],[-5.0291677925776845,53.173388631073259],[-5.067016627677547,53.410745744458715],[-5.0180243568232274,53.603403280781308],[-4.8586805322191768,53.792854112729358],[-4.6279881226051218,53.882648791367444],[-4.2361298884833518,53.910727548848861],[-3.9256879898261072,53.77898629583261],[-3.5707969936915425,53.817586998799683],[-3.9273820369978245,54.118819324985232],[-4.0323434444098822,54.280497259926172],[-4.2898496765463685,54.304791574262488],[-4.4707479137621036,54.260785769028125],[-4.6364727044873941,54.272584508199316],[-4.8460842679939464,54.194046905102979],[-5.0598807213769872,54.212930556771177],[-5.2050504397791686,53.975280004927988],[-5.3076667922849259,53.872200416916812],[-5.575671070368359,53.76444503021677],[-5.7960329189715392,53.604043909834992],[-5.9932227846972221,53.552201236454316],[-6.3006877886552406,53.589165700052511],[-6.7451167832411638,53.568058357392921],[-6.9202537711359788,53.638405496116796],[-7.0313904316596938,53.736324798013243],[-7.163205924401816,53.659801739828531],[-7.3026767906793184,53.624241269988012],[-7.693032028618016,53.651455126263365],[-8.0870967074126572,53.772762352532609],[-8.4618641677579287,54.067082761868029]]],[[[-2.1247119729756099,60.099558399359942],[-2.1588349435208847,60.246925039531753],[-2.1473263404942449,60.397752277823564],[-2.0066810136607782,60.726371125469548],[-1.8873530816119399,60.888568487628831],[-1.6673131518032307,61.029670770769471],[-1.371273583753748,61.106502752860109],[-1.1095552764478422,61.271086274718407],[-0.92148220239570222,61.310171960204698],[-0.58851820083961504,61.275970842116685],[-0.42505245121649637,61.169462191960051],[-0.33628394876524598,61.052617087077003],[-0.28525877963234081,60.915034175065642],[-0.27637176726260299,60.768563541238557],[-0.36156626260068619,60.498138564408798],[-0.46977941999297629,60.332965192933798],[-0.59911788739179483,60.238931136500241],[-0.79095318052724028,59.718574593603073],[-0.93973227339538234,59.524429185321544],[-1.0604039336706699,59.439831226024467],[-1.2987088601539889,59.387289743741299],[-1.6079134023665973,59.479577448094069],[-1.7582844411613776,59.614883065843358],[-1.8363313829667736,59.776230369958945],[-2.0356010754690077,59.92961613832329],[-2.1247119729756099,60.099558399359942]]]],"type":"MultiPolygon"},"properties":{"alpha2":"GB"},"type":"Feature"}, +{"geometry":{"coordinates":[[[13.038568732977302,45.337968793569758],[13.019529372010133,45.527011989946828],[13.072392332989995,45.70950948231026],[13.189524240855915,45.859108758786405],[13.327640729726035,45.949482070097389],[13.570401786181726,46.016564021504003],[13.80226240621829,45.971410063385626],[13.978552916046848,46.008971425719395],[14.191356971832686,45.997688106305837],[14.345816355724486,46.104478528736323],[14.528661536102934,46.155364015427203],[14.717298352962221,46.134439291567823],[14.8863166509444,46.043278294984823],[15.096655426485174,46.200521828795203],[15.185968688265977,46.43055176225009],[15.368181382356402,46.622650557768587],[15.766519656330814,46.757260738638081],[16.128575740649758,46.993518261844301],[16.316920952622162,47.034072878914223],[16.966836721784226,46.86574309811698],[17.551029511467018,46.446599184074643],[17.775936079609018,46.384325025546445],[17.960571238588905,46.283212875719492],[18.311012505664088,46.261796022423681],[18.517722706341786,46.384694369589759],[18.854532090488433,46.428951252407643],[19.003469859278539,46.421744345595606],[19.143659299822801,46.37093766062344],[19.262632300587349,46.281049821807215],[19.349807689143713,46.160075237253189],[19.404580093332974,45.903741900127073],[19.528063894307277,45.699805987967544],[19.707996129472214,45.583582334973485],[19.810818206175359,45.475181700141079],[19.877021177516799,45.34124050530103],[19.900693627365268,45.193718668924895],[19.863020377676357,44.99869307702005],[19.752387393772594,44.833724600902613],[19.533599837817022,44.707097846865423],[19.377432899917267,44.521317393732119],[19.056252098230868,44.377600240878046],[18.908310994130019,44.367042332277308],[18.698466387973227,44.404279477361897],[18.531292884315167,44.48670971706909],[18.418831293820737,44.603792105925486],[18.256132646786796,44.629095212348709],[17.774067656754688,44.579850244461639],[17.559287106493027,44.646588321212619],[17.14215192643681,44.661006384613721],[16.937975469015392,44.719794397225762],[16.697228070616749,44.696901726957385],[16.609829570878631,44.622608077453897],[16.690994206394237,44.455929851045674],[17.298675031064658,43.982071211456329],[17.578463822981377,43.845170878844343],[17.671593026843485,43.735543725351825],[17.743784362125247,43.57367605810439],[17.98356707778963,43.362843036549719],[18.713515731315081,42.975555076893947],[18.857419474342098,42.828853735823245],[19.008611721696553,42.523120856267283],[19.013609422060107,42.377982719579414],[18.976688087623369,42.237530340484007],[18.900962410389948,42.113612312991272],[18.79282062537207,42.016682389524377],[18.661385597660871,41.954917600034676],[18.517745215493647,41.933528435932161],[18.328203482994859,41.970421017313228],[17.85939434012252,42.214043199275928],[17.63438868527431,42.212791153480268],[17.190159006363707,42.314938273357697],[17.027006562158377,42.404155364082307],[16.778748303994249,42.400962934020185],[16.440622431993607,42.504275428910894],[16.326767248321332,42.597238991391833],[16.23760190028915,42.726671632153121],[16.041767329432645,42.842678701316181],[15.914093566780219,43.025813359811494],[15.663078658078163,43.138015138345708],[15.517756461214637,43.324215350621628],[15.387494128214396,43.394486172754924],[15.003097852356056,43.427415295662001],[14.823335643619266,43.517317681437113],[14.454179589079963,43.883400821182249],[14.367065755706529,44.134824262737062],[14.186774041324973,44.216812983881915],[14.063739772318245,44.345938919907077],[13.759108411996255,44.348101007184709],[13.548286332418787,44.44740049285214],[13.190572964250663,44.868879906257732],[13.038568732977302,45.337968793569758]]],"type":"Polygon"},"properties":{"alpha2":"HR"},"type":"Feature"}, +{"geometry":{"coordinates":[[[-10.8652743784004,51.981044836589412],[-10.881474827842036,52.226862017576309],[-10.77389973643567,52.477890945107688],[-10.638778083318236,52.618723412932397],[-10.391895533412622,52.721835831436003],[-10.251703312621618,52.93957965502851],[-10.452317685122699,53.067400329864213],[-10.571084292851769,53.273227653053681],[-10.611333219746069,53.61770135544166],[-10.718875703943482,53.768149287233683],[-10.76001003433046,53.907632237151027],[-10.759268083188729,54.053052235646867],[-10.693760165457084,54.234977726825214],[-10.435709221210963,54.57641145215959],[-10.170192756702679,54.744389845168733],[-10.012977615761722,54.775451402477913],[-9.2501178957903978,54.793749903950179],[-9.1218467140159252,55.029995729769311],[-8.8278584360772712,55.218114603672191],[-8.627854822455145,55.499786104775843],[-8.4656865593959427,55.608049638576077],[-7.8550915955915226,55.739170219251271],[-7.6597501087354267,55.747344242536187],[-7.4636957036897025,55.842326963466036],[-7.3262287487318227,55.865174939138399],[-7.1877950638057619,55.849196560762955],[-6.7455331306919533,55.688433603092363],[-6.5556284939179195,55.52884552073369],[-6.4876557324693467,55.39531246074305],[-6.4622999779569996,55.247635583329838],[-6.5191021111817804,55.006169965155507],[-6.7089520495471282,54.807418698608032],[-6.3987447994082487,54.583662235100064],[-6.1333923868312583,54.581231121358506],[-5.9499529391149313,54.510464301464602],[-5.8382396454079872,54.413561953549646],[-5.700067690887165,54.21979533571885],[-5.6574461873334574,54.03183880935542],[-5.7006915199488857,53.81481592895738],[-5.6465893380002949,53.644670902747826],[-5.6345596726801848,53.388868303841548],[-5.5345239938591018,53.009687422058114],[-5.5318320064509754,52.862779415148175],[-5.5719588675029028,52.721432167871917],[-5.8280395750476641,52.271806252032214],[-5.843791919214306,52.126435475001806],[-5.8998905585529453,51.989192363078622],[-5.9937698979077103,51.874434362275551],[-6.1171750409358543,51.79225224877019],[-6.4811089426543296,51.695041306511122],[-6.687141884508117,51.701332012287956],[-6.8098724707642786,51.666023273880072],[-7.2696532450384357,51.632493387233325],[-7.4673467956939286,51.518588756051798],[-8.7018820582275254,51.097767604581378],[-9.7316811353758368,50.974070797777053],[-10.016645271708589,51.017662638576603],[-10.158386365405486,51.1027100478778],[-10.348356002404516,51.155845831549101],[-10.464079759978404,51.237641060112196],[-10.780968576867213,51.561780513987514],[-10.866804454378933,51.761469538818375],[-10.8652743784004,51.981044836589412]]],"type":"Polygon"},"properties":{"alpha2":"IE"},"type":"Feature"}, +{"geometry":{"coordinates":[[[43.571496310822681,39.163679655712336],[43.529281528090834,39.301788045008095],[43.528299597833225,39.446200824525462],[43.568632436658866,39.584870493837933],[43.646915315389514,39.706228666091008],[43.798647076726915,39.823927853804776],[44.004903091927069,39.881937780048759],[44.114135321618036,40.031336974679881],[44.280437582879507,40.163214474788084],[44.493891895199063,40.259534415322179],[44.727792400353238,40.248096404965096],[45.088244089594561,40.070302566596311],[45.49497256758891,39.622232735120676],[45.694466925293995,39.476008896774403],[46.19605658579782,39.380480043814302],[46.362739258180959,39.400447949008154],[46.62182885034224,39.591748877847415],[46.783027905280093,39.649896140371574],[47.203365851820365,39.917780829197667],[47.600718526537079,40.1176867448876],[48.064216111334794,40.179016832751493],[48.28671667310892,40.090385710590851],[48.745377658739969,39.664848786377902],[48.820528300165805,39.435244321937141],[48.768345945834888,39.175439792887097],[48.783822936896392,38.932530949351602],[49.039434917676346,38.905167942605175],[49.166227219422545,38.837000637444426],[49.268342828849882,38.735534034139391],[49.35186605567376,38.56329663884248],[49.457599874692683,38.041385350098786],[49.586945633882024,37.986944248416933],[50.299400142216271,37.877495218296339],[50.474586841719749,37.769592414235547],[50.69330298612028,37.518171927938184],[51.100894108051349,37.286157125479477],[51.797894638462985,37.119200484211653],[52.139605036947337,37.122194782005565],[53.415377752898003,37.370801822706895],[53.482960314170853,37.595957587903044],[53.649596233928186,37.767418421968948],[53.828893578210717,37.835949892967612],[54.153421405855084,37.838366453702783],[54.373427716550985,37.897809244696482],[54.594146861910161,38.17306863847859],[55.014551162224691,38.434975782029028],[55.462488325813446,38.585936963982427],[56.040885437555531,38.586424832454703],[56.284710619328528,38.724313775009264],[56.645571571444016,38.755970032551986],[57.324313846779603,38.698772808578617],[57.493239732294874,38.616385674510809],[57.69465581691145,38.408535177910771],[58.134720939765344,38.306116449548682],[58.418366423518449,38.159765900659771],[58.883811801691699,38.178537697779909],[59.443697300304819,37.993525796718835],[59.641608842737071,37.865636802598956],[59.784282640084349,37.659275132671837],[60.230416416623342,37.454591358489807],[60.557072241705619,37.150774565009243],[61.173603948594483,37.139424117285174],[61.391856278444436,37.061679882398188],[61.576416381479923,36.862995337784149],[61.655705522730926,36.689573365354669],[61.69081423635398,36.115162875526963],[61.743915549668799,35.956663419337339],[61.778028969828725,35.498395122350381],[61.748483268868505,35.343876316028485],[61.624973939504073,35.083296077373632],[61.548909545924111,34.682528935359365],[61.378609964690078,34.418214714390828],[61.360492349270316,34.153205098892208],[61.207603366978283,33.935028159717049],[61.317804980727708,33.817721663855835],[61.394055742253521,33.654177073548659],[61.416717219858704,33.509403807720446],[61.396434460973786,33.364278169882631],[61.306116607893948,33.191643462381442],[61.11108779689615,32.989543964777269],[61.31804618620837,32.353956952107112],[61.295876476591872,31.932408082766116],[61.818408849295963,31.856466028160927],[62.023053955027422,31.726048775551842],[62.152397686320874,31.585755746592199],[62.225707378268282,31.453012039611124],[62.310188746173402,30.945699431485068],[62.28518374510486,30.759778280718841],[62.196632090012841,30.550684621569506],[61.54884392416546,29.868133675631647],[61.731119046450061,29.654358559109316],[62.014989805514517,29.115728386468017],[62.123105948062367,29.013417951724055],[62.55674508905399,28.871121462943773],[62.745236105077858,28.7460535809258],[62.982998867599349,28.689818962046193],[63.101356491020368,28.60665474016729],[63.190953854156611,28.493089220128738],[63.253145649763866,28.311076088595296],[63.244941250817192,28.007940019599111],[63.278305078892821,27.738939769352449],[63.436399738072282,27.675286593709302],[63.643973932159291,27.515555388825749],[63.735731699630513,27.39902994555549],[63.789269644832302,27.26071380317072],[63.782476941503461,27.015236580848928],[63.582533513622892,26.385778584054712],[63.487873220088318,26.276087154585674],[63.365736569762838,26.198142177080481],[63.226379514392868,26.158488778870179],[62.835713383529516,26.142506551718824],[62.668013986555948,26.101078786705273],[62.528224347113415,25.949234563937384],[62.251727251233454,25.831383621134407],[62.161481796489653,25.590485370619277],[62.069906269385001,25.070239237955441],[61.982699508012793,24.895942816476591],[61.87681662661786,24.794575037420227],[61.615731252460158,24.645690360057312],[61.374106531016075,24.603822120532481],[60.535679154123599,24.829652385496384],[60.356724727664634,24.813693985945665],[60.025826381489978,24.874052457402652],[59.824567885357176,24.867392879707324],[59.418663343878912,24.962286345350666],[58.9593956268995,24.925088430226484],[58.642638892627218,25.063835131834132],[58.113428709572524,25.09986076286231],[57.896787298995399,25.162895325856358],[57.730553636902442,25.157633976990034],[57.488370903531788,25.25824983094893],[57.152038822060973,25.326331815297589],[57.019892811483722,25.403325862526035],[56.891277300482827,25.560766295113275],[56.622573430254754,26.238584416221592],[56.570012229738197,26.545144648252229],[56.221037966030579,26.278511800359801],[56.091692313588325,26.220658599527571],[55.869637585719317,26.207411666871991],[55.484996503817698,26.087147527008629],[55.330829582071139,26.092075613445829],[55.154043602334191,26.142064208923692],[54.94186054898892,26.039567673555634],[54.802058874932989,26.008283465417801],[54.483793204018802,26.035832852000919],[54.10882887073555,26.205423454454117],[53.577258847969439,26.242660157758724],[53.433264331043958,26.30668194987285],[53.147247624148079,26.535389851545489],[52.755307675632615,26.696809903098409],[52.427176721195536,26.899256871566983],[52.316442250656685,26.993143211126235],[52.180899001045816,27.198314738252432],[51.89559773338194,27.329329832221173],[51.549036564753656,27.359114371949293],[51.273298925172767,27.474003241635568],[50.877956285459028,27.833045799986358],[50.644377415997845,28.293547549921737],[50.595947610638675,28.449162741312989],[50.46093691113898,28.578805288145961],[50.38353346455262,28.741313355886522],[50.223783039436626,28.932173255863862],[50.159368855437492,29.210435567542159],[49.797141473947583,29.588071387023476],[49.653938372409968,29.539128621909484],[49.466481163560189,29.53711008577887],[49.332637436418942,29.581353728384844],[49.185369790443353,29.682009898542912],[49.006125602235912,29.56689328172126],[48.531391053008036,29.462846516242958],[48.307664937602254,29.523360613113464],[48.082691314733275,29.682669266040477],[47.940338142201192,29.920723718379346],[47.706154720651853,30.072766455633502],[47.604453464253737,30.180699430513009],[47.526157294611451,30.361650792649336],[47.514402194361402,30.531216277790513],[47.333533728594446,30.641825895670273],[47.21977799451755,30.806489268057938],[47.182250182901868,30.952284819456246],[47.179687627379472,31.400520606035098],[47.243216775189538,31.688431341870231],[47.040899200109536,31.973896849615763],[46.856696282156641,32.042735137240768],[46.221856461929598,32.43902749330362],[45.951097095005629,32.48481395184433],[45.781607540618253,32.583413707208855],[45.643749184847586,32.784988566453777],[45.58155174321459,33.103629510140955],[45.372335510114603,33.26247383773044],[44.974852381156737,33.703689583519754],[44.901143910782636,33.933880166925967],[44.912909807377304,34.079354641371332],[44.973879944838792,34.228672003137845],[44.938594575382197,34.388051658607331],[44.954489706227733,34.543050004387297],[45.079511723482511,34.850394827780697],[45.501138502923894,35.319484078958766],[45.482336298528963,35.399056062300858],[45.330580844439268,35.51330335011091],[45.098424414269829,35.590497740663182],[44.959479367434575,35.718625239805505],[44.837125127797627,35.994456463420434],[44.662444285463238,36.160252484651998],[44.565360384688233,36.411157013189161],[44.434384036817576,36.574732174494791],[44.300495031922871,37.014798423631369],[44.133564227915038,37.199368444975306],[44.071625565984547,37.404160368398735],[43.908304256134116,37.49195785455511],[43.785616170136457,37.638346793531774],[43.723271490083306,37.867958996204067],[43.740358166647127,38.010578299145926],[43.823952192295451,38.239581215951873],[43.766114900452592,38.652704621347105],[43.67773099339535,38.81594473172359],[43.646700155874846,39.004584568509728],[43.571496310822681,39.163679655712336]]],"type":"Polygon"},"properties":{"alpha2":"IR"},"type":"Feature"}, +{"geometry":{"coordinates":[[[[6.1921875296159996,44.872739907496111],[6.1405913072778242,45.006347022475047],[6.1342707297264329,45.196695461784273],[6.1995865600799904,45.375598565036469],[6.3520590381775728,45.534125984405371],[6.2973403359558286,45.686516009565366],[6.2926664226736531,45.832788874855368],[6.3521678679641331,46.018052268648781],[6.4411396295063019,46.134248749807199],[6.8786744425540318,46.40478154903505],[7.0195538534782651,46.425493783800157],[7.1693035131869411,46.403114389977524],[7.4638215168132671,46.47231721596674],[7.6378428161445404,46.469997260769837],[7.7885222492255011,46.665147961230296],[8.2439368595161806,46.927516369561573],[8.3876164399956501,46.945067227294288],[8.5923649535000735,46.906889270123798],[8.7250911055733251,46.840151256859599],[8.8337652570249627,46.735325989021767],[8.9686219657198016,46.881111818055381],[9.1436190983332395,46.961233372963648],[9.4554669159969222,46.98129368349948],[9.6924275826741866,46.905779904071466],[9.8249518033976582,47.025452839957516],[10.010722242504496,47.096748741324646],[10.164211239803935,47.272830475979674],[10.347178974805434,47.353322105434984],[10.497249601182224,47.362677851433631],[10.826669665022942,47.302139532186899],[11.143535720079891,47.465133758691806],[11.703460972544994,47.48537712301107],[12.149524496354909,47.581516695533487],[12.33885412035977,47.552333208705207],[12.503313912479857,47.454096966894483],[12.595573075178647,47.343449345726029],[12.665723381669364,47.161472850655528],[13.859017211366032,46.994027993900829],[14.060337238808131,46.866415392371948],[14.179699741442255,46.66009689469621],[14.197140580163062,46.469540655159427],[14.124641184087194,46.254075614661126],[14.130295144606043,46.077081341762799],[14.27562839028578,45.913266549934164],[14.35868161465557,45.739323714412137],[14.369764607450406,45.546889010217775],[14.329436744986769,45.407648322294811],[14.217227409525611,45.250922405028305],[14.008043440465109,45.133084761723708],[13.661363109455328,45.091271075591202],[13.521316773922953,45.128988721089293],[13.333519027307474,45.235602485354001],[13.003200371521938,45.105701997098627],[13.003951704508609,44.830581290068579],[12.942666060361981,44.695798693251376],[12.816115002788493,44.533584551404495],[12.951808661089405,44.426242637395134],[13.899554293341362,43.941710815655782],[14.245105097795072,43.417044902932268],[14.429958107446478,42.989739709545752],[14.822662098396986,42.659606230017701],[15.084143771592128,42.505194723524859],[15.269027461059988,42.434690950199389],[16.015487027100736,42.436635809858416],[16.362361296352027,42.355172013950749],[16.521530620218016,42.246004724829952],[16.607016609164955,42.128691338435516],[16.679393377090854,41.91108773061908],[16.682586867329267,41.737961816839494],[17.314127845753937,41.515394931359879],[17.694443505298281,41.292793522250598],[18.257810793606314,41.052754720169332],[18.66858453673775,40.736861718980805],[18.894429352287268,40.469168253124415],[18.982294152635017,40.162065933004449],[18.949911596887166,39.919418494661791],[18.694448559325078,39.470925912686518],[18.574159370888133,39.381326430993056],[18.383021957181157,39.324517205114674],[18.184883423346438,39.346920786822096],[17.877086836668774,39.479310954941525],[17.710970341246647,39.597685557549248],[17.547963614918626,39.810621574961296],[17.320217298218182,39.845470428340029],[17.507778459599187,39.688998819539513],[17.597807937728248,39.507850890964221],[17.673611086671485,39.024694406914819],[17.622362326078559,38.776223721295722],[17.53406590739727,38.650910756642041],[17.345386702842138,38.484795109971827],[17.212428971922424,38.432728523905801],[17.047923983315911,38.421626392106944],[17.007999827774896,38.21950058223586],[16.927849334766027,38.087167926985686],[16.62247983050425,37.867374584625352],[16.350120881867277,37.537206015338896],[16.112273113447841,37.44516538955601],[15.689446535479217,37.441123721065352],[15.791136443549263,37.116720388400921],[15.779766885017191,36.925605031716337],[15.724157032362752,36.792797953500681],[15.612060741180946,36.654647405011644],[15.517051154144545,36.394393920676066],[15.324484301514437,36.235290216739543],[15.129447192697107,36.188368580501177],[14.623741211602105,36.234351008249959],[14.266737501739836,36.358047763785756],[14.018091373712767,36.597659497117462],[13.722447276193392,36.63510382702794],[12.979089571318768,37.013976837003931],[12.800261518839509,37.077585311320512],[12.497648035928552,37.115407138969147],[12.3861196400031,37.164776983914322],[12.484367891337588,37.015958911330898],[12.548303225069404,36.809012512018434],[12.529734360534842,36.612969651625789],[12.436907772583053,36.439300914052609],[12.326838245827144,36.340191388089657],[12.144419708102275,36.266022102429396],[11.996419232818811,36.260203324831053],[11.743991839722336,36.320900313038727],[11.619138139120375,36.397760595747542],[11.497224173662612,36.549871284443142],[11.442742313658316,36.737040735795546],[11.447033257013102,36.929878653100701],[11.550820643084544,37.14655336843019],[11.743689474096978,37.289806179203843],[11.932644656081042,37.328526973083626],[12.207025173098502,37.285845450206949],[11.982357791247132,37.617388160842005],[11.938422735891217,37.854439227806822],[11.968244523281811,37.996924909086047],[12.097544024566789,38.270178126435567],[12.221605134191154,38.431716278076408],[12.492147215324799,38.620088911034998],[12.686402655842038,38.680383779441087],[12.939051880250387,38.638733603486109],[13.135172895146766,38.68945312391029],[13.419397260529866,38.676091181801141],[13.829281817710594,38.506348840460248],[14.394633865749423,38.544595934713016],[14.697295735507875,38.658090252990128],[15.042397724459356,38.661869258975798],[15.4081964791453,38.781724753797228],[15.474287263902983,38.907238058687327],[15.592898169860023,39.024554641337893],[15.549606070589824,39.176647435700097],[15.346998878129655,39.56454418196661],[15.117328996414473,39.602696662781291],[14.687300931067213,39.81437541150666],[14.544413019720023,39.948177361448934],[14.468522239761407,40.110103499004794],[14.249648325951988,40.107325346153701],[14.005006477056291,40.228693379226137],[13.822925237310226,40.210964891105291],[13.632665490847545,40.267695946159527],[13.512841455493323,40.356826066498783],[13.424684631679353,40.477367977116181],[13.376059305516197,40.61856838595336],[13.371154548931605,40.765650395083902],[13.098182962096008,40.744191021052174],[12.945248609078376,40.76511613672119],[12.639250258637373,40.945985513198643],[12.393752074754488,41.02976986996417],[11.798375695618844,41.518090061178114],[11.495103009786048,41.691578921431393],[11.322578228622506,41.876478320849941],[11.230721520251441,41.913276243146726],[11.005591958613785,41.924171578105408],[10.821820613661988,42.003245216833328],[10.712616967696009,42.106793530851071],[10.631685706534139,42.261641098342302],[10.369489683248581,42.216064406099214],[10.03182778295664,42.25226356613036],[9.8469023188329245,42.331073124602653],[9.6832622311493211,42.520480661052765],[9.6284225115923423,42.782696380777182],[9.642927815139041,42.932621266335751],[9.7014244992468761,43.071423330762471],[9.8949472724594028,43.251972202032768],[9.7919049141767101,43.566554572997156],[9.5543342754881859,43.633658615828701],[9.1462152122732512,43.831265618696563],[8.8041444286569259,43.900040617910534],[8.2967875341659791,43.469919179590875],[8.1641078316581588,43.403898955938487],[7.550804403832184,43.270710669863455],[7.403362531274233,43.275572341026226],[7.2637568502458132,43.323248283119497],[7.0807431691768787,43.485037171100359],[6.9948950081737946,43.737307984417569],[6.6410813177913282,43.908349013922717],[6.4934227444048425,44.045351751964958],[6.3547095539028264,44.404236958193515],[6.3521070616011253,44.604099250963515],[6.1921875296159996,44.872739907496111]]],[[[12.218364732843659,35.06120794226851],[11.995547299265201,35.167008780441876],[11.89633808512256,35.278154891145007],[11.834281105604184,35.413598079930154],[11.8266701879358,35.660141179604274],[11.937852327107253,35.880322827327092],[12.051375559848809,35.97680288600835],[12.713281502399749,36.36297212856649],[13.013417848661854,36.374042640325555],[13.22849369880732,36.268520191097672],[13.32469291243263,36.160504779155396],[13.385948078409038,36.029472635921806],[13.397975018018721,35.790207173870819],[13.325702070355494,35.611972498835542],[13.036057148341836,35.173152554334088],[12.885275001571205,35.047305841415252],[12.697655342607536,34.989241097313581],[12.218364732843659,35.06120794226851]]],[[[7.6825400019787127,40.7332852839886],[7.7174344802547505,41.104083632712054],[7.7751071461515098,41.251193315318297],[7.9880666339874669,41.495357526700126],[8.1607773619575408,41.595496600191019],[8.3086914162806487,41.621451380185647],[8.4576409509671358,41.602313611570985],[8.6777572021092997,41.470558425388518],[9.015306528178165,41.709142439743886],[9.2569961320013103,41.755979760865607],[9.448221619472319,41.705862562924665],[9.9176295822625402,41.415211985633036],[10.066113408522584,41.233030805183169],[10.304198785805367,40.528753992581144],[10.277631178469926,40.336278294937507],[10.188385526310489,40.16444276825132],[10.199459905147235,39.933514815589774],[10.055265396439385,39.082658329330378],[9.9592314720420667,38.862161056565526],[9.8144309072035991,38.734429935098554],[9.6503428341526138,38.667488157176344],[9.514133598298594,38.640593425071593],[9.3330314445431473,38.663992745365839],[9.1367434577613569,38.483323012983163],[8.9613248587795002,38.41958201839639],[8.3096460806300811,38.481632278762866],[8.1208361863178258,38.569483609424402],[7.9567931511996424,38.745009442063548],[7.8773625836624976,38.920577507030181],[7.9000246687812332,39.507062151510702],[7.9425076989170211,39.687019317546458],[7.8995730126268766,39.982245711841017],[7.9408630355575616,40.193040258117982],[7.7498411080180025,40.414777524333914],[7.6982313661394777,40.562145548349939],[7.6825400019787127,40.7332852839886]]]],"type":"MultiPolygon"},"properties":{"alpha2":"IT"},"type":"Feature"}, +{"geometry":{"coordinates":[[[17.937141419460705,42.535559176650779],[17.972983087968803,42.747712016695644],[17.952632929687724,43.052413513271333],[18.02245356022252,43.238118608540191],[18.2032414713773,43.413104529143602],[18.319753042484702,43.583062774377964],[18.504652065719487,43.721977039005672],[18.645250991524957,43.918589773667215],[18.764229579807079,43.995839962845153],[18.900115001564696,44.036566469586944],[19.366107014756384,44.002600926426815],[19.501177541002509,43.927743346243751],[19.849174787591856,43.624892077879089],[20.111855868833953,43.552377747382408],[20.530232704559552,43.361499577901185],[20.671481074101138,43.266838979403467],[20.761465533544797,43.161351585693829],[20.844001994316987,42.909352492694687],[20.824697563845486,42.690155314682876],[20.703736988693056,42.480757672309714],[20.529223290086872,42.364230344713683],[20.444175014569957,42.222909697432122],[20.328747403330123,42.123423096052854],[19.855089238267219,41.981276435993358],[19.821341948789382,41.726620688582273],[19.731216078489549,41.555368913745355],[19.582812403260274,41.431166691299303],[19.398361700383401,41.372619436108955],[19.205494569227859,41.388497490206539],[18.959417786674379,41.503393381947575],[18.832026108523824,41.596266798469223],[18.620368998857732,41.825418046318731],[18.213912706949341,42.035902007051234],[18.00686189573813,42.270384510563758],[17.937141419460705,42.535559176650779]]],"type":"Polygon"},"properties":{"alpha2":"ME"},"type":"Feature"}, +{"geometry":{"coordinates":[[[-13.754021182655915,8.8569949261048251],[-13.789856712596002,9.099353645696084],[-13.706256697269657,9.3296425329777666],[-13.565998003680303,9.4675770716263248],[-13.372440922472288,9.5427568966037395],[-13.274507086467098,9.6507290016956464],[-13.139093386115427,9.7322341057017496],[-12.914722747499891,10.143120819265455],[-12.767553953909095,10.285159112323845],[-12.537132811141392,10.385082831515851],[-12.331327892288282,10.426659079482297],[-12.173202393617794,10.418485395136242],[-11.958117458805148,10.490544828040306],[-11.225048084898702,10.493355940196706],[-11.020618799722406,10.441981626820434],[-10.845634177397784,10.324338851525363],[-10.269401950421308,9.5834022362461564],[-10.212162301783842,9.4590273694481066],[-10.118942876781748,9.0152055557077357],[-10.086600917985381,8.9438997773294435],[-9.9397512487138648,8.8480703350598322],[-9.8484631695483227,8.7314656882996236],[-9.7953338072700831,8.5932360680740185],[-9.7850237029127385,8.4455070635016316],[-9.8635217943989488,8.0955718155729457],[-9.9860236331750727,7.8613207143379897],[-10.138165144245944,7.7267578605493057],[-10.254470851280802,7.4506611807796279],[-10.899003212004912,6.888226748119795],[-11.21298768014211,6.5028107619198394],[-11.395668389977555,6.4195325559920748],[-11.546281063685012,6.4083705024388875],[-11.739242243399994,6.4638095180464097],[-12.150333625632678,6.7318430955079398],[-13.173550058911539,7.1231617150174662],[-13.327938163053549,7.2423805066189413],[-13.407066812844864,7.3659199257931363],[-13.446932933335628,7.5071078280536003],[-13.444104317648737,7.6537888774123708],[-13.402768306439969,7.784308352544806],[-13.554671550609923,7.922770663675065],[-13.758923474882266,8.3139650844551287],[-13.766855121864284,8.5048650519779123],[-13.713747478938668,8.6809837989313579],[-13.754021182655915,8.8569949261048251]]],"type":"Polygon"},"properties":{"alpha2":"SL"},"type":"Feature"} +]} diff --git a/toolkit/modules/tests/xpcshell/regions/world.geojson b/toolkit/modules/tests/xpcshell/regions/world.geojson new file mode 100644 index 000000000000..52b5d590ab93 --- /dev/null +++ b/toolkit/modules/tests/xpcshell/regions/world.geojson @@ -0,0 +1,10 @@ +{"type": "FeatureCollection", "features": [ +{"geometry":{"coordinates":[[[15.736847696159515,44.765948043809509],[15.822952348808796,45.202543518181905],[16.023282362939035,45.191238642440595],[16.160329448933929,45.074889390308577],[16.275396601018592,45.047038332021472],[16.530732408676027,45.216452550954592],[16.767589731132073,45.203100462762308],[16.918665332527368,45.276268558152061],[17.184306515792422,45.162087435641702],[17.511139661484556,45.126773059286776],[17.658492410731288,45.162786448211925],[17.853359415430237,45.089385439300464],[17.996344382788212,45.141526116369263],[18.284938667062928,45.134010031120944],[18.662522932024221,45.077198051132832],[18.93102518529226,44.86841765964725],[19.312604066764759,44.897189905241319],[19.356549663122202,44.85853461884583],[19.334262354106176,44.780746758848302],[19.164585691029515,44.530058386332975],[19.148353362723608,44.418048952597267],[19.208748156429998,44.301366530732878],[19.583551214479847,44.043344917227238],[19.458013852729081,43.860190720873184],[19.493525250987101,43.637853926094834],[19.451176035916401,43.562298081333829],[19.293812920256176,43.579560893936794],[19.111452835505716,43.494562346829035],[19.026457971872453,43.292635485300593],[18.836146161893289,43.318221596680992],[18.700410894833567,43.24791526177578],[18.623396954738769,43.027872401603645],[18.478787999409271,42.880811920136786],[18.534796961233702,42.620255448928127],[18.436331005293756,42.559938564240412],[18.308262924403127,42.598139287571144],[17.782678784090965,42.884013539218543],[17.585405842872582,42.938507817517269],[17.55525685020973,43.073519824515863],[17.293234834120359,43.305734473916253],[17.219946804794038,43.451706679826621],[16.717070157262267,43.776332757856295],[16.304507923504151,44.120816103881943],[16.214430263824394,44.215239179706039],[16.107543286101222,44.491790285638537],[15.736847696159515,44.765948043809509]]],"type":"Polygon"},"properties":{"alpha2":"BA","radius":200000.0},"type":"Feature"}, +{"geometry":{"coordinates":[[[[-8.1445372282146629,54.453481019421169],[-7.9714299610759873,54.557345604707038],[-7.906099650038275,54.700672426414954],[-7.5436642941935537,54.781582480127888],[-7.3723125670832506,55.029551424115269],[-7.2186566892972293,55.091723128426757],[-7.0724014328398432,55.081350920213737],[-6.9470496736565615,55.182301245649874],[-6.3217354291314782,55.26591101791773],[-6.0228935740376643,55.152819932588748],[-5.9708193056128627,55.016469208256765],[-5.7170630566401881,54.817332416858214],[-5.4706486621502206,54.500180308979012],[-5.6069390729919455,54.272745173467712],[-5.8025616214230817,54.222286338543832],[-6.0190905962436796,54.051531644426632],[-6.285367434378899,54.092748838479729],[-6.649671858273658,54.058864089121826],[-6.7332392499841704,54.176112482446406],[-6.9800491956310475,54.321208738651109],[-7.0954031608198518,54.294162621372834],[-7.3551865268327425,54.121476352830221],[-7.6019590017644205,54.143090869247665],[-7.8547599293735564,54.215503384706508],[-8.1445372282146629,54.453481019421169]]],[[[-5.7675849552138967,55.348839697253133],[-5.7370809875397963,55.577272307778031],[-5.8456967234094082,55.712930089240338],[-5.9820512391507457,55.7261510106405],[-6.2867734036245455,55.592626846790786],[-6.4927545319826168,55.701950318482147],[-6.4450453965980845,55.832149686464973],[-6.1656764913123778,55.931038469719148],[-6.0839965360221253,56.082753210905537],[-6.1505866278649872,56.241670602835519],[-6.3132664859938732,56.293893115808203],[-6.3054068021506398,56.44785780629234],[-6.3730596559347097,56.566782856042515],[-6.481422715244836,56.613270202206138],[-6.6658310709390376,56.584200553688426],[-6.4377912490991545,56.709257806070688],[-6.3712605085529166,56.80737149115123],[-6.3719577929368034,56.925913249330371],[-6.4322944527488977,57.017939730599807],[-6.3874346877841086,57.176066459116342],[-6.4506426497132647,57.294779751782933],[-6.7410722990549896,57.412673685263741],[-6.7773355444656209,57.564540403232847],[-6.8538894717438135,57.649290381804178],[-7.0211453446371195,57.668153399725931],[-7.2491144975526716,57.452076408211177],[-7.2500393693371326,57.115514002165582],[-7.4170231060430458,56.965682979762335],[-7.5394484047696579,56.964365303928538],[-7.4326984714828441,57.105978310456855],[-7.4081623044028584,57.30730843469312],[-7.4140599621992784,57.481473092922478],[-7.5153498920612654,57.615782984723012],[-7.2440355528157889,57.66898782661351],[-7.1176168203918895,57.747011912473582],[-7.0448994548163357,57.914059691345699],[-7.0850468820804808,58.182011286771434],[-6.8622069282334115,58.233780898906161],[-6.7421502111820244,58.32132585937584],[-6.2375089051216159,58.502546737722341],[-6.1988985344198078,58.363359405282914],[-6.4663269108760444,57.970966697966055],[-6.4867045242641703,57.821625782629567],[-6.4130290185215779,57.711302608097533],[-6.1663019673970449,57.585149403630972],[-6.0768709401319603,57.427389375209415],[-5.9081026554396248,57.396897282849444],[-5.7668777929013961,57.512057357960991],[-5.6652709111029012,57.823368534682459],[-5.4545292061573258,57.958634541937641],[-5.3381322088738248,58.23849579207576],[-5.1286670526059392,58.318865588446748],[-5.0166008084246014,58.566305147833425],[-4.9198589003295448,58.587733159651442],[-4.6615981776745867,58.528256817961058],[-4.4919628974989472,58.568188418627912],[-4.3544262014811972,58.528122716455115],[-3.538926496028171,58.616330159829893],[-3.4074112433864885,58.723378218580422],[-3.3958063066996504,58.904695507074216],[-3.3102069655376436,59.130615177400273],[-3.1305814394833993,59.184242653686354],[-3.0421154303677302,59.333613761934188],[-2.975570721010675,59.346880518465781],[-2.7429844507849239,59.241777751303033],[-2.4074303064406668,59.297367047516602],[-2.7323298749276557,59.157527705617731],[-2.762723898366811,58.955828919886869],[-3.0281522784397574,58.656845348417761],[-3.1369006169997142,58.378455543264941],[-3.8193001998900362,58.012904996850224],[-3.8659541093164607,57.909367153726734],[-3.8425936204956157,57.774801120340122],[-3.6783665734657069,57.66031114307313],[-3.3981911900304582,57.708332732787014],[-3.0572936569214795,57.672834538768328],[-2.0740818394816869,57.702198982588818],[-1.8641172085432383,57.608023738326445],[-1.7808632711799279,57.47412252432742],[-2.0132187386850839,57.265315005729803],[-2.2604104523436654,56.8634785288952],[-2.6514128848864824,56.490233040282753],[-2.6612537821101609,56.116304457646436],[-2.5517329955739783,56.015159614699854],[-2.1471601044658928,55.902792303217787],[-1.6555809185129815,55.570156064626126],[-1.4192794442475947,55.019901715232869],[-1.2230009027285171,54.698998629670776],[-0.67152689080055139,54.503655755986351],[-0.084747477915200362,54.118006980452719],[-0.1371452617889892,54.015795601670717],[-0.12550038459585297,53.903568852727446],[0.11508432238835389,53.609219710294845],[0.13865060033405333,53.470393912301219],[0.27082089715413132,53.335368794520427],[0.42687957364755991,53.014028653857366],[0.5312029724886963,52.9686861206035],[1.2656127090015035,52.925466347965219],[1.660109842461956,52.749368943373426],[1.7174136639988775,52.672533954111564],[1.7463695421805738,52.469037538422896],[1.5912398416473401,52.119899670836226],[1.3325445011310466,51.947712832917553],[1.2741874496491108,51.845535537644679],[0.99432574420641862,51.743587664313679],[0.91470374430759738,51.607886732188071],[0.93193699848275979,51.475707832252702],[1.0284028445288225,51.383715510919842],[1.4147065136430843,51.363099851945648],[1.3973620903737751,51.182140883637089],[1.057395921296731,51.046920828776607],[0.9600122906786005,50.926102373677935],[0.77411952811319851,50.9264851897086],[0.29963046038712088,50.776279453307517],[-0.21811132264638622,50.814113847656721],[-0.9313413070217591,50.773309898463459],[-1.2514842402775819,50.589020835698477],[-1.6944887033252294,50.730649341797431],[-1.8547310134375237,50.712261346938085],[-2.0358434757856707,50.603430831332119],[-2.3188601764549599,50.633128438358149],[-2.438601523816843,50.599989356735286],[-2.7770890777709583,50.704943403925668],[-3.0137289044530116,50.713627497963103],[-3.417065411182802,50.613577343449911],[-3.5845324041795075,50.321954034493892],[-3.6798913967470566,50.24019159475322],[-3.793312007249658,50.229485393897882],[-4.2322182711301526,50.373711274434598],[-4.7412942714461437,50.285336932137547],[-5.0134923248258714,50.157739094350006],[-5.1186391664912962,50.038547685058347],[-5.2251882433658254,50.021658732098501],[-5.4340073689416881,50.100998369576061],[-5.6220837316175576,50.050971700315259],[-5.6560317940734253,50.131779224515981],[-5.575014101838474,50.193657413799087],[-5.3120453531141028,50.265386758737236],[-4.6183073109028401,50.752841347205397],[-4.5229161602194052,50.977247831803908],[-4.3052236584776837,51.039982321968054],[-4.0791702092555626,51.30492295802334],[-4.1055055420037352,51.489284706465597],[-4.3715247471991461,51.726560092663426],[-4.5725459581582557,51.74188476285439],[-4.902290276755819,51.626490111906143],[-5.1246067810145268,51.706126503235218],[-5.2619445500974678,51.880200369088662],[-5.0879716404859048,51.995568904392719],[-4.3654724928920379,52.205878750744837],[-4.1749692220835772,52.307980968601015],[-4.0772985102528736,52.432264304214371],[-4.0734219578610515,52.733037302573415],[-4.178389199933207,52.876667552467694],[-4.3391693016282309,52.89950617129886],[-4.6828082601172882,52.806412376965731],[-4.4824804612044069,53.054677338539925],[-4.5676142281229151,53.386307182326803],[-4.3151683197310797,53.417014143738264],[-4.1784300191671937,53.31834866970398],[-3.9461989464741585,53.273806453792837],[-3.260808993925659,53.348354791911035],[-3.0901544930743121,53.466505044482403],[-3.0198056219208049,53.71382812674964],[-3.052210098148104,54.035929492131977],[-3.5691982163186697,54.467680831322177],[-3.581692128417886,54.704473843820878],[-3.6780921908903195,54.82373895272675],[-3.7920468193110217,54.847132703090693],[-3.9579607968197195,54.781258183202588],[-4.1329097867985256,54.779526115062914],[-4.2832435970386289,54.828645852662433],[-4.5174840913730554,54.758596706736725],[-4.7446700255647913,54.805087827866643],[-4.9113262644562878,54.689772113154383],[-5.1698893118041012,54.917985264425624],[-5.1724694508855551,54.985745383518037],[-5.023464677831682,55.062980356329376],[-4.9460359835358521,55.195301540850465],[-4.9485242872280004,55.310251553535053],[-5.0138955736270283,55.404836393683922],[-5.3967471828525282,55.485820306502902],[-5.6185648492829969,55.331717538812271],[-5.7675849552138967,55.348839697253133]]],[[[-1.6602666138729454,60.284735364471686],[-1.5880166591601448,60.364795312275639],[-1.5525184163464214,60.517238786505253],[-1.4141091615364703,60.59852376647396],[-1.1939135987617608,60.62330885630557],[-0.91567627204159163,60.810205670168337],[-0.77449494640548067,60.811845158590415],[-0.82567285451122352,60.684162948147019],[-0.92783050213491769,60.663908775362195],[-1.0129667847911246,60.584384551972882],[-1.1995604016662578,60.006741452962459],[-1.2839562523413324,59.887072056916473],[-1.3555692564562354,59.911228269968383],[-1.3466304861496661,60.024834067268706],[-1.4006976279850656,60.124389917080705],[-1.6412209433006493,60.236966608228364],[-1.6602666138729454,60.284735364471686]]]],"type":"MultiPolygon"},"properties":{"alpha2":"GB","radius":543000.0},"type":"Feature"}, +{"geometry":{"coordinates":[[[13.517470270902946,45.481681412961557],[13.577901929104218,45.516620276812517],[13.829367707948267,45.441437271859101],[13.992765309699706,45.509173458670048],[14.346727917556155,45.486947176559113],[14.568857013048559,45.656982310673591],[14.770440679152728,45.492855884445],[15.153303338917556,45.484986975365544],[15.254126553644262,45.574635132900276],[15.277233297391595,45.732449233713417],[15.599011852948321,45.888076793216555],[15.631446137957909,45.999206333742258],[15.592844315865188,46.139945114587398],[15.636077684566658,46.200475746508992],[15.981482547818329,46.298527320862412],[16.326024710646589,46.53415576419436],[16.747945287710756,46.416202732755579],[17.331015396854873,45.987800707420845],[17.602255097113808,45.915459462384149],[17.80742400587998,45.791639450673308],[18.375576329983428,45.75691741272226],[18.541477805357658,45.801994803503099],[18.66609504156548,45.907215940610747],[18.905105063683603,45.931515453150894],[18.900862733010669,45.755860434244482],[19.064022577487716,45.514927825555731],[19.096520834810178,45.380648256807497],[19.400714513764392,45.189148552637349],[19.175934366721929,45.124465510099931],[19.085046905760326,44.926916247799603],[18.94708291505594,44.86553680380905],[18.83212606510029,44.886083473516237],[18.724723493115778,45.029144443677929],[18.619849823408373,45.078540033344623],[18.26418583512703,45.13385336206894],[17.812859706055399,45.078343150039089],[17.687761612275722,45.143112332935615],[17.205967441396709,45.15691724358981],[16.94047963456579,45.246860746812118],[16.790751515185377,45.197155294557184],[16.511399760600717,45.196403306799752],[16.293317107835069,45.009094420658897],[15.970365014579857,45.18120083555867],[15.841510568502491,45.142690086919892],[15.771976812638822,45.04999175720237],[15.772326807115578,44.773125924336171],[16.103269684582681,44.520810899148458],[16.292177342898007,44.132873551276361],[17.055848644308931,43.537376327587815],[17.247929282345723,43.470008357466234],[17.321307968043701,43.279354637871833],[17.698052037937597,42.948096021551422],[18.436145177283926,42.559543567730501],[18.516704205963823,42.433527352230143],[17.92726753773335,42.743184195463002],[17.744171904813324,42.700589928291819],[17.344313309397123,42.790581470361801],[17.193009826440193,42.913333755653639],[16.85067131148023,42.895762975445173],[16.696490277547539,42.933846896319508],[16.587874494200701,43.114286146521835],[16.37676839745372,43.21385828645623],[16.398615676939365,43.367006723590038],[16.304193122228416,43.490182969893461],[15.985689760650468,43.520012620663437],[15.869989587268675,43.702314771027872],[15.527470461977696,43.887088834075939],[15.132301965507086,43.910433201277165],[14.865366564275744,44.167874495587007],[14.948662747645743,44.25161976802174],[14.967716525472259,44.383567524254431],[14.748382876744827,44.670842684951204],[14.614236703060801,44.700459807194491],[14.480337865966735,44.621560165294831],[14.316069953117916,44.885544296956922],[14.201012423826828,44.954476541780828],[14.068276476801014,44.935213681396341],[13.965701987466977,44.835868528629589],[13.860886511975339,44.837632638812991],[13.62950968323198,45.108326260854987],[13.517470270902946,45.481681412961557]]],"type":"Polygon"},"properties":{"alpha2":"HR","radius":310000.0},"type":"Feature"}, +{"geometry":{"coordinates":[[[-10.389990189259278,52.134977034923125],[-10.352484365451229,52.208801582445304],[-9.9525578224876412,52.339122286453716],[-9.8986156655020459,52.441340470610783],[-9.9162839626291834,52.569608490737181],[-9.5260938690230681,52.779405872788494],[-9.4247828891071279,53.046206252497285],[-9.4708042313180467,53.193104471960311],[-9.6253219805170946,53.303179304403812],[-10.091032107184104,53.413048606546703],[-10.116701661150374,53.548382488799284],[-9.9670107482938874,53.647120412682263],[-9.9454821569053351,53.813554013934777],[-10.06074806219052,53.943782401934008],[-10.264960629619429,53.977818324769963],[-10.143981795067123,54.051015593077693],[-10.089438124288328,54.215722767230332],[-9.9959243444886994,54.275742301161067],[-9.3199556037415228,54.298810678898569],[-9.1498499660110308,54.24061841644005],[-8.6756399686272214,54.298529095764344],[-8.5925027817935113,54.393610253169712],[-8.580240601523963,54.528540061455288],[-8.6413743949491924,54.628004495256469],[-8.7634685391492813,54.6813338824455],[-8.4790972221905641,54.840229116162064],[-8.2744805545528379,55.146053682195571],[-7.7576383350281466,55.248759307866166],[-7.5380233385424287,55.245457820545823],[-7.3137832015166619,55.365329854782743],[-6.9622035948751506,55.237818567889768],[-7.368514422255994,55.022417322089495],[-7.5505368477417916,54.768171189872795],[-7.7071457520394064,54.68417402910989],[-7.8885554953508326,54.468151357478476],[-7.866743711969665,54.278246972788892],[-7.5876156912659543,54.141597032985615],[-7.3641026250574031,54.139951075627692],[-7.2583058648281531,54.194951369470232],[-7.1373096345482727,54.352414588975662],[-7.0077691210635926,54.406458637429573],[-6.5540429024391766,54.079180103369559],[-6.2181216237211911,54.088462457159928],[-6.1572352339861469,54.017316108298253],[-6.2334147934979285,53.935003019169791],[-6.253004279440006,53.82195722059565],[-6.1420498835673527,53.577448527109993],[-6.1320549726263422,53.313194494892208],[-6.0276682351425555,52.927172227766597],[-6.322615957020135,52.414876898254008],[-6.3295539983599332,52.244905734831505],[-6.5562544109132253,52.189362213008259],[-6.7463454901751154,52.21177730304764],[-6.8902634261150171,52.15951825287965],[-7.4407362485401238,52.121990628276158],[-7.6296768820355441,51.991504121702278],[-8.8135199722474713,51.58514525707816],[-9.737325859295872,51.474038933853606],[-9.835184730506807,51.483572578357624],[-9.964607562522108,51.601064081954618],[-10.120534864519058,51.600927317495859],[-10.19070641860405,51.752274618808244],[-10.34092850429294,51.799193096907686],[-10.378444319203119,51.868728004083643],[-10.336824360254688,52.03303831780385],[-10.389990189259278,52.134977034923125]]],"type":"Polygon"},"properties":{"alpha2":"IE","radius":237000.0},"type":"Feature"}, +{"geometry":{"coordinates":[[[44.023537649478712,39.377358452381699],[44.345576342535594,39.434853953714672],[44.45617017559281,39.666628654694641],[44.587099820675292,39.768298949757629],[44.817079960644236,39.650219223471865],[45.151311949470831,39.254197341484705],[45.48997336373467,39.005967905509159],[46.178611665162975,38.87481522789264],[46.560236323026324,38.920532307412081],[46.85265248984674,39.148217089306961],[46.994633708835224,39.191845817457803],[47.472086922095372,39.496130516272068],[47.777804634792354,39.650096635643401],[47.995820753402626,39.683716847880376],[48.321834944375716,39.399120411699997],[48.230984014892421,39.269381749411984],[48.291825643407186,39.018924471203341],[48.184491194885737,38.870564708816943],[48.206246525355006,38.721467038681475],[48.599335449277632,38.425485404318394],[48.868531303925849,38.43528289835816],[48.955113659894984,37.907516313524411],[49.112521391927373,37.644143978436546],[49.453415504873931,37.500663038806344],[50.130386575255017,37.406927036007062],[50.370152467652005,37.126788268535179],[50.915307213656149,36.816467547847431],[51.741007062471155,36.618682801009307],[52.190037379804551,36.622617508570315],[53.824828035665789,36.941185590516639],[53.952962316885262,37.081934917636481],[53.914440982408088,37.34332260826335],[54.214562712965389,37.336957245612119],[54.678378651656864,37.462274168640256],[54.900268841271291,37.777734180390219],[55.227729707299751,37.982698314184695],[55.578438972536539,38.099567302588447],[56.183543944939181,38.082097967262314],[56.436537932156526,38.247922688737248],[56.663995237990207,38.256309579333006],[57.193504672419365,38.216187106445624],[57.430696748654064,37.955837185049084],[57.978830270625977,37.831039509174516],[58.304224860613878,37.651803010967065],[58.815424793583347,37.683236559963746],[59.278925283690924,37.521455693300929],[59.444522733491915,37.262491154618274],[59.952046533632846,37.039247876244261],[60.352371830781671,36.653762315581623],[61.119515720650426,36.64235826289778],[61.169678079367614,36.572196517988068],[61.195235358612479,36.00592720190491],[61.251919893053397,35.86755520494841],[61.278268520720815,35.513870700125153],[61.143760476940471,35.236989845538098],[61.079844573268176,34.85567064445133],[60.833878703273136,34.521774881973769],[60.889001153219574,34.319626407764112],[60.650982176990176,34.290601041653119],[60.505543573074327,34.109765098512533],[60.543264344516892,33.650575688361698],[60.632193573553458,33.575883177044787],[60.902083233810195,33.539917003815987],[60.916734050904992,33.50530127642844],[60.599652144879165,33.182296532747955],[60.566174783922655,33.044961268802894],[60.829103809160124,32.24938471905066],[60.78780997043544,31.891152134628289],[60.823801041610551,31.564779055518834],[60.95091727572521,31.472159311697506],[61.66004930206234,31.382206337906776],[61.756425479421964,31.280459150863376],[61.810945435944923,30.918201846280041],[61.781041860549188,30.828685990584749],[60.965755031801493,29.983982681591748],[60.926066082123967,29.820605359860764],[61.318160015226226,29.372463474848036],[61.610132554826905,28.81046204447944],[61.862038845691472,28.572082820750786],[62.352937167473868,28.414544710249125],[62.562326809993756,28.259147540696823],[62.757742216191566,28.243434104555988],[62.743150592699223,27.991488528882336],[62.823571762210058,27.343082276622951],[62.935257122790645,27.243777698544921],[63.171820728197396,27.25102494385909],[63.301369471796583,27.151382100761431],[63.160661249462265,26.654151072831009],[62.76629438362027,26.640388324877303],[62.423744487785299,26.555766216234275],[62.307248067717403,26.483611209788773],[62.239256756492324,26.357275899552594],[61.86529989369641,26.22513209916049],[61.67665574122806,25.721571599315421],[61.587724004504636,25.202527799195046],[61.41215859574568,25.10237205822159],[60.550678695852156,25.344860383902848],[60.400151256927252,25.311804552543286],[60.042842139269894,25.379783797681998],[59.897111705450534,25.362102283464989],[59.444917900387679,25.470072817156623],[59.046143940843947,25.417505661878462],[58.779264296185481,25.556386511702559],[58.202962224136535,25.591779200989826],[57.934319874484231,25.67450920750796],[57.796177486606766,25.653308780011113],[57.681664743496448,25.732461818699967],[57.334717732238573,25.791765393562336],[57.10457972468042,26.371512713186686],[57.03524008029791,26.800364185688462],[56.901970312080842,27.002872262124843],[56.727739553042746,27.126463529991064],[56.384926147898994,27.149608781814582],[56.303128817431705,27.069427856248545],[56.279142840973101,26.952257313765021],[55.954277033398952,26.701404936768402],[55.811247019467629,26.71585897670629],[55.423696661989091,26.583375629187241],[55.108512869342569,26.677451646093861],[54.763898557284847,26.506825128829188],[54.644985606777134,26.509137203653211],[54.229958724578097,26.700071980902134],[53.70585693194635,26.725839764941671],[53.404647530023411,26.970467539941065],[52.982622429092416,27.142150225615367],[52.691731941461953,27.323533356220313],[52.581509919721469,27.512691467293472],[52.45455988223155,27.622845052913927],[52.02014998360346,27.822333313711859],[51.66633023914757,27.845161894262876],[51.522111223346975,27.907699495109433],[51.279143604737044,28.131456146406386],[51.094049400356738,28.512168469512549],[51.043729216412125,28.7407558689411],[50.867164049602806,28.870317744098521],[50.804582359509432,29.067623680289735],[50.67537586167505,29.1467983310595],[50.629029248612717,29.443457407116735],[50.169155273207643,29.921385149485658],[50.051812558753063,30.14241638563508],[49.901890390524407,30.171012776817896],[49.554921537239281,30.029226230914855],[49.407846355012872,30.140865512028341],[49.100054849208448,30.259763485341381],[48.976319394514327,30.20910840014815],[48.832344691580836,30.035721816573709],[48.546523496367136,29.962617472940106],[48.434730934497082,30.037729973689963],[48.337779003099193,30.260406069523164],[48.015182840771281,30.465833397738088],[48.011154626828038,30.81797210912082],[47.968309169552178,30.922270552285951],[47.857533701982049,30.992009098111986],[47.679711725651138,31.00260393595795],[47.679687626462631,31.400550885433514],[47.796992919933118,31.799054411985178],[47.512068574286737,32.150955329314542],[47.391283310153291,32.385989819352773],[47.278173186545409,32.464679768743132],[47.12146388509835,32.466879118021467],[46.394914815750326,32.920420048053593],[46.112894767236639,32.957911735881233],[46.080736726638975,33.081550007389033],[46.116450225591151,33.245121767280594],[46.029215915049186,33.401994134301432],[45.738415661726847,33.603040017195688],[45.400062913432357,33.966740915472066],[45.525850988773236,34.186372276796888],[45.437858838750699,34.415166144092133],[45.500990030238555,34.581404052968516],[45.603630620731735,34.636152085065596],[45.678307578293854,34.7983177278767],[45.917679423475356,35.025464942360379],[46.065799862514609,35.115622900562045],[46.101979035068226,35.298947222391611],[45.975636003099886,35.476894301785244],[45.989714675677362,35.646259613982856],[45.928417807185632,35.767883536170281],[45.723571571285461,35.836879846264303],[45.547980392110055,35.982691199409743],[45.361797775268109,36.015508884889385],[45.252582189582654,36.314231719220736],[45.08074132227803,36.434164129150666],[45.002896033134213,36.691750864078244],[44.881041253952759,36.799448285134531],[44.737314944712814,37.307491409912622],[44.574258887484959,37.435563739226808],[44.520085703022517,37.729497272818222],[44.362877946270089,37.851987771644772],[44.223116496772583,37.880407662309196],[44.366515650342642,38.261996407851989],[44.291839994735959,38.415644783768961],[44.252614944875987,38.814505802731517],[44.14649701530513,38.989894197669535],[44.149203974009659,39.111509081969658],[44.023537649478712,39.377358452381699]]],"type":"Polygon"},"properties":{"alpha2":"IR","radius":1175000.0},"type":"Feature"}, +{"geometry":{"coordinates":[[[[6.6280087630782605,45.11781102465077],[6.8839579386959739,45.160906362106097],[7.0372035189879281,45.286910116676495],[7.0396672785692109,45.458475598361069],[6.789367686136722,45.775449055582968],[7.0211017390767898,45.925496179755726],[7.1574968595798723,45.885881589795247],[7.5386046173676045,45.977941359081029],[7.8431868625785608,45.944136334617575],[8.0407579752875336,46.079218811335316],[8.0958973660513553,46.270787038272289],[8.3757639256531959,46.44520772913129],[8.4366047659179966,46.431769533673716],[8.4639100519911601,46.263120443024761],[8.5743614503477001,46.154073422459781],[8.9813598693500758,46.050387124873687],[9.2196821331420935,46.242284735506388],[9.2603728268485437,46.475055867439409],[9.4274568375599781,46.482078864502732],[9.4798570820592243,46.369642189494009],[9.5968807956281275,46.305877317524072],[9.9254984474922949,46.378090804470659],[10.016321756748322,46.446730966899786],[10.087162235347948,46.599723243410082],[10.359441244550167,46.672001885842469],[10.452971335319914,46.864642275222224],[10.927681366582323,46.773692815345029],[11.244482647633085,46.97543005458332],[11.767143921463948,46.98662664058461],[12.169429012637845,47.081913042392777],[12.221563604867335,46.886967620716334],[12.432386132617518,46.688021942930959],[13.699702217296499,46.520088406332306],[13.593032222710951,46.318332157569053],[13.634726305245813,46.157825347814544],[13.616613018525346,45.899272369533527],[13.874411198989353,45.614896368099238],[13.719993146486662,45.587821696130241],[13.601920843623503,45.70860879348178],[13.225500582023528,45.750872135246318],[13.030182456495941,45.637715557675016],[12.401574606876617,45.442218902055046],[12.315615983497898,45.36259237012441],[12.30975023765358,45.172500236400161],[12.389785297598538,45.051680583327673],[12.52316882600763,44.967868666546948],[12.276173150355369,44.658930836850324],[12.30621705133902,44.429831929789053],[12.399182202096156,44.22587389028913],[12.683958281455363,44.000598738854201],[13.563948035844312,43.571078329318134],[13.801440256441774,43.186477106943855],[14.017309437704409,42.683432210430105],[14.532683972685284,42.250173592198152],[14.866391526550016,42.053110886079402],[15.178529075313767,41.93407996968137],[15.964056810413968,41.939287910685664],[16.164459495200063,41.896004422432348],[16.188899222721183,41.814054310968011],[16.02384711298118,41.599356405538231],[16.100491994040006,41.411213884785546],[17.103351393713424,41.061993026572068],[17.47482149697214,40.841728847803012],[17.95485277990926,40.654990415666354],[18.3280984615573,40.370707062301129],[18.460407256055682,40.220924783960093],[18.485576186350027,40.104870985940032],[18.339001714299709,39.822575653709471],[18.078092371065388,39.937128358653894],[17.825245256194417,40.274234933742115],[17.400471375045196,40.338764528349998],[17.112389182404051,40.506731729929911],[16.921366754200207,40.448795476878701],[16.670189322346129,40.136865690416705],[16.530846080369891,39.785697518895219],[16.607289535005794,39.652274633641461],[16.829652524495078,39.575369209696163],[17.114299202820657,39.380495862527724],[17.174315823148049,38.998156889640924],[17.098455975698393,38.919565412536599],[16.913347266026083,38.930051863891798],[16.624657067309595,38.800821090712141],[16.568362904860301,38.700875979764604],[16.545401846472405,38.409245431164258],[16.276136159373063,38.240352567158297],[16.05671727227201,37.942069352622561],[15.724622878040059,37.939350143513082],[15.549313669694385,38.03990224635421],[15.395907100613098,37.970954249702359],[15.231270281539507,37.774698637037062],[15.117164200114267,37.491598779576606],[15.123011651279667,37.377161522776163],[15.230033310544576,37.244243794048188],[15.295566913650024,37.05030622548783],[15.135149978484186,36.872371173207291],[15.11239091555078,36.688077579229343],[14.775999083378666,36.71060465966071],[14.506714013153047,36.796694858806276],[14.357708389986312,36.978025878905939],[14.162325010200263,37.092842989328759],[13.900979070189267,37.102143866566969],[13.178081561452673,37.473884321691813],[12.908858567110936,37.569645941211803],[12.640372442700851,37.59460411695575],[12.526916188997786,37.66969307984165],[12.437516205669329,37.824344237777844],[12.547809877331133,38.052782952076988],[12.734395700604688,38.182692441708141],[12.918317930920457,38.07778894256009],[13.16003183334397,38.190071473074269],[13.346973862580215,38.18136413440083],[13.765645238082257,37.983340279939725],[14.043995655943716,38.039661083948594],[14.497062983663088,38.045974784447111],[14.789704341752014,38.166703796632184],[15.121684618622988,38.160227352374299],[15.498782783549748,38.290667493749403],[15.784010292351454,38.297674034286267],[15.885626268054864,38.444138402649365],[15.879162532568472,38.613850913735391],[16.091098460618348,38.777883535789201],[16.141776239954272,38.922612219951702],[16.016490575135606,39.362762898182133],[15.695107336018795,39.978059478941532],[15.572958579619646,40.048299851238241],[15.294597007591927,40.070217841139225],[14.951004084614279,40.239182010807248],[14.9439001727792,40.474992793833167],[14.790812971268092,40.648274018455645],[14.340183436120805,40.599060431160581],[14.296762954728361,40.729102564616866],[14.162670361146807,40.803331852727474],[13.867823554209735,40.708944952091265],[13.954418481006186,40.972092582014056],[13.760365039498218,41.211827526224731],[13.273333329026409,41.286486387095245],[13.088683992186809,41.24410078247984],[12.856888774765377,41.402992487198347],[12.630978989285675,41.46991006469991],[12.081754311277624,41.933180203961577],[11.807187549207498,42.082223568462553],[11.619588712926431,42.296123739716634],[11.32798821830964,42.412939294431105],[11.107334472097705,42.41371060714188],[11.075942959338224,42.61155372010532],[10.709843043244083,42.88623658205654],[10.521156705827961,42.882289075274421],[10.419040511594879,42.713603063301036],[10.131389459849684,42.742250782794471],[10.127673304615906,42.810057770824912],[10.34004877166133,42.834275556350491],[10.466054059214882,42.909072537972882],[10.528009011145288,43.158997344739333],[10.450902196605707,43.36075360697572],[10.32074732901035,43.513208684543493],[10.228716716977639,43.880341793459827],[10.067776032708387,44.009589007179557],[9.7309532959539666,44.101425354288914],[9.3082250004532785,44.308698413485232],[8.7664181894537982,44.417631315052198],[8.5437136845740262,44.337866732297847],[8.0101635987738362,43.879610184691451],[7.4933809634965725,43.767402272872829],[7.4917020040256368,43.981094958641002],[7.4366454870169161,44.080929324832852],[6.9003620914137551,44.33586916599716],[6.8432449521334462,44.510694295543502],[6.9217420119123316,44.656458086680296],[6.9116528802546036,44.772600787814753],[6.7383799327697309,44.921532899867699],[6.6280087630782605,45.11781102465077]]],[[[12.314795896534243,35.551820855540555],[12.845496573363279,35.880769707367563],[12.907133814184595,35.885469509652943],[12.64652091481568,35.486619494808288],[12.314795896534243,35.551820855540555]]],[[[11.936656683268247,36.828543069704878],[12.024052370905448,36.820742053326043],[12.050993333293217,36.757216068689203],[11.940848547661476,36.780516932123987],[11.936656683268247,36.828543069704878]]],[[[8.1811136237816573,40.771025761493455],[8.2059281697509565,40.997435072841867],[8.3201701138540241,41.121583158049035],[8.3767792406108263,40.930000193232104],[8.5269303500990734,40.850209449495139],[8.8108349332662783,40.94649034062784],[9.2283494430750963,41.256801068197774],[9.6151519729423729,41.017082238113517],[9.8050506055200337,40.499580475175101],[9.6645388076348979,40.258801957761847],[9.7064888647541512,40.017058536680956],[9.5622943560463014,39.16620205042156],[9.4863204791000548,39.139819256134494],[9.2718721042763868,39.209882789646542],[9.1451924215657598,39.194778795078768],[8.8812757475398847,38.913132562707453],[8.4215468050679281,38.968949657757591],[8.3640870761090103,39.035029542628877],[8.4129024338589282,39.223195660782714],[8.3993730402654165,39.481543454520178],[8.4584390438233239,39.637895628174974],[8.3995564162623158,39.978171882055456],[8.4701768066806089,40.226197595333979],[8.3570374759474735,40.491935474284823],[8.1901463712381126,40.651697922739515],[8.1811136237816573,40.771025761493455]]]],"type":"MultiPolygon"},"properties":{"alpha2":"IT","radius":633000.0},"type":"Feature"}, +{"geometry":{"coordinates":[[[18.436561457593239,42.559634589662757],[18.485583314999349,42.693067607015863],[18.446254219041478,42.97280181377473],[18.582994785284971,43.068780935719801],[18.674428016886342,43.230634536954803],[18.893055009531299,43.383407396285804],[18.974268050625607,43.542095716847243],[19.19417769552917,43.533090213886553],[19.258656103927663,43.438758067589873],[19.414475330504207,43.342596961704032],[19.581103222817795,43.194022261051913],[19.790950645963907,43.109004933559255],[19.94396580741639,43.081407549517188],[20.273176592327481,42.93263811406451],[20.339748280983006,42.892735579298574],[20.346638871409969,42.85806970833017],[20.344112628901339,42.828134009794582],[20.240022844527481,42.794305048556978],[20.132154399646236,42.708833960641186],[20.063841292674045,42.547480583355068],[19.78833318363985,42.476421879552262],[19.705529705021728,42.516221649269568],[19.605228851452292,42.515534430217336],[19.470563040397348,42.420613622193578],[19.334630067517494,42.229611212720151],[19.331408729068553,42.148704824762902],[19.361187067996386,42.069059764977169],[19.34217703022891,41.86945269067192],[19.186590724954407,41.948806062630581],[19.107653055197158,42.071567415905164],[18.893485786171656,42.248300879135094],[18.517572765721965,42.433130617181732],[18.438325115799834,42.523049287954642],[18.436561457593239,42.559634589662757]]],"type":"Polygon"},"properties":{"alpha2":"ME","radius":96000.0},"type":"Feature"}, +{"geometry":{"coordinates":[[[-13.292390465789737,9.0490810558633754],[-13.067937208828253,9.090623562001527],[-12.958618689414513,9.2631538211079985],[-12.773252737214834,9.3570935871031331],[-12.501252039161544,9.8619767754975207],[-12.431688372235014,9.8963278107705701],[-12.277756046954694,9.9295373062842671],[-12.082452367580203,9.8883070511265228],[-11.910949372241118,9.992774628440241],[-11.269210499241103,9.9953100776906005],[-11.205821900819593,9.9775466891338027],[-10.690712308738112,9.3141484860866335],[-10.597460522031998,8.8597501061416928],[-10.480861213427795,8.6026783403051876],[-10.401608997366401,8.5166889685830949],[-10.283465946900481,8.4849447283471093],[-10.314789455875601,8.3108797292811811],[-10.386362712936458,8.1608680748935569],[-10.566787833576033,8.0541733333502776],[-10.647663415385852,7.7595294496783556],[-11.266778619811953,7.2317283215498165],[-11.507505003722724,6.9068646520272265],[-11.921156261501652,7.1796428136565229],[-12.951020665303135,7.5709123922701931],[-12.867119099800586,7.6599906489701244],[-12.853553663719339,7.7945451716870755],[-12.950311818259809,8.1139882753386647],[-13.022874590848339,8.1845375113030769],[-13.148821611115851,8.2148080356202637],[-13.272523648517536,8.429789127349343],[-13.214212059521909,8.5930901347726643],[-13.212791270161233,8.8577844027102],[-13.292390465789737,9.0490810558633754]]],"type":"Polygon"},"properties":{"alpha2":"SL","radius":203000.0},"type":"Feature"} +]} diff --git a/toolkit/modules/tests/xpcshell/test_Region_geocoding.js b/toolkit/modules/tests/xpcshell/test_Region_geocoding.js new file mode 100644 index 000000000000..6fb7c6096dc2 --- /dev/null +++ b/toolkit/modules/tests/xpcshell/test_Region_geocoding.js @@ -0,0 +1,52 @@ +"use strict"; + +const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm"); +const { Region } = ChromeUtils.import("resource://gre/modules/Region.jsm"); +const { sinon } = ChromeUtils.import("resource://testing-common/Sinon.jsm"); + +async function readFile(file) { + let decoder = new TextDecoder(); + let data = await OS.File.read(file.path); + return decoder.decode(data); +} + +function setLocation(location) { + Services.prefs.setCharPref( + "geo.provider.network.url", + `data:application/json,${JSON.stringify({ location })}` + ); +} + +async function stubMap(path, fun) { + let map = await readFile(do_get_file(path)); + sinon.stub(Region, fun).resolves(JSON.parse(map)); +} + +add_task(async function test_setup() { + await stubMap("regions/world.geojson", "_getPlainMap"); + await stubMap("regions/world-buffered.geojson", "_getBufferedMap"); +}); + +const LOCATIONS = [ + { lat: 55.867005, lng: -4.271078, expectedRegion: "GB" }, + // Small cove in Italy surrounded by another region. + { lat: 45.6523148, lng: 13.7486427, expectedRegion: "IT" }, + // In Bosnia and Herzegovina but within a lot of borders. + { lat: 42.557079, lng: 18.4370373, expectedRegion: "HR" }, + // In the sea bordering Italy and a few other regions. + { lat: 45.608696, lng: 13.4667903, expectedRegion: "IT" }, + // In the middle of the Atlantic. + { lat: 35.4411368, lng: -41.5372973, expectedRegion: null }, +]; + +add_task(async function test_basic() { + for (const { lat, lng, expectedRegion } of LOCATIONS) { + setLocation({ lat, lng }); + let region = await Region._getRegionLocally(); + Assert.equal( + region, + expectedRegion, + `Got the expected region at ${lat},${lng}` + ); + } +}); diff --git a/toolkit/modules/tests/xpcshell/xpcshell.ini b/toolkit/modules/tests/xpcshell/xpcshell.ini index 23c7ff4281f2..25272e9af5b2 100644 --- a/toolkit/modules/tests/xpcshell/xpcshell.ini +++ b/toolkit/modules/tests/xpcshell/xpcshell.ini @@ -7,6 +7,8 @@ support-files = chromeappsstore.sqlite corrupt.sqlite zips/zen.zip + regions/world.geojson + regions/world-buffered.geojson [test_BinarySearch.js] [test_CanonicalJSON.js] @@ -40,6 +42,7 @@ skip-if = toolkit == 'android' skip-if = os != 'mac' [test_readCertPrefs.js] [test_Region.js] +[test_Region_geocoding.js] [test_Services.js] [test_sqlite.js] skip-if = toolkit == 'android' || (verify && !debug && os == 'win')