#ruby-on-rails #postgis #geojson #rgeo
#ruby-on-rails #postgis #geojson #rgeo
Вопрос:
Некоторые географические регионы — это области, окружающие крупный мегаполис, где каждый является отдельной административной областью. Это касается столиц Швейцарии (де-факто) и Бразилии.
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-47.3051,-16.039],[-47.3614,-15.9764],[-47.3478,-15.8249],[-47.3098,-15.7514],[-47.3136,-15.614],[-47.4307,-15.4911],[-48.1967,-15.4903],[-48.2208,-15.722],[-48.2796,-15.8356],[-48.2464,-16.038],[-47.3051,-16.039],[-47.3392,-16.1328],[-47.3193,-16.2301],[-47.363,-16.3289],[-47.4297,-16.4058],[-47.4561,-16.497],[-47.4014,-16.5719],[-47.2559,-16.6561],[-47.1503,-16.9375],[-47.1505,-16.9746],[-47.2989,-17.142],[-47.5064,-17.3271],[-47.5339,-17.4585],[-47.4641,-17.527],[-47.407,-17.4981],[-47.3052,-17.5329],[-47.2755,-17.5703],[-47.2747,-17.6754],[-47.3214,-17.731],[-47.3543,-17.8473],[-47.2777,-18.0589],[-47.4759,-18.185],[-47.5503,-18.1974],[-47.6053,-18.2528],[-47.6359,-18.321],[-47.9492,-18.4887],[-47.9945,-18.4417],[-48.2729,-18.3279],[-48.3081,-18.3574],[-48.4575,-18.3633],[-48.5522,-18.3465],[-48.7995,-18.3561],[-48.9282,-18.3018],[-49.1928,-18.4631],[-49.3796,-18.6418],[-49.4845,-18.555],[-49.5817,-18.5364],[-49.7865,-18.6364],[-50.0242,-18.5988],[-50.1828,-18.6575],[-50.326,-18.6906],[-50.4161,-18.8187],[-50.4933,-18.9689],[-50.49,-19.0295],[-50.5435,-19.1086],[-50.6787,-19.1246],[-50.7392,-19.1695],[-50.8439,-19.2975],[-50.8808,-19.4132],[-50.9234,-19.4567],[-50.9392,-19.4295],[-51.1096,-19.2932],[-51.311,-19.2561],[-51.4151,-19.1619],[-51.5364,-19.1354],[-51.6322,-19.1334],[-51.8468,-19.0512],[-51.8904,-18.9996],[-52.0868,-18.9043],[-52.222,-18.8242],[-52.2951,-18.8139],[-52.4682,-18.7113],[-52.6467,-18.7209],[-52.89,-18.6781],[-52.8453,-18.5353],[-52.7612,-18.4278],[-52.7663,-18.4017],[-52.9102,-18.347],[-52.9832,-18.3877],[-53.0439,-18.3511],[-53.0581,-18.2831],[-53.0417,-18.125],[-53.0539,-18.0167],[-53.1146,-17.8817],[-53.1261,-17.6717],[-53.2166,-17.5365],[-53.2271,-17.493],[-53.201,-17.2836],[-53.0382,-17.0464],[-53.0135,-16.8668],[-52.9685,-16.8192],[-52.8391,-16.7675],[-52.7165,-16.6584],[-52.636,-16.5332],[-52.6147,-16.4125],[-52.5827,-16.3502],[-52.5008,-16.2859],[-52.4483,-16.1973],[-52.4431,-16.102],[-52.3312,-16.0418],[-52.2417,-15.8797],[-52.072,-15.8716],[-51.877,-15.8006],[-51.7497,-15.5409],[-51.7043,-15.4813],[-51.6633,-15.2264],[-51.6394,-15.1799],[-51.5164,-15.0595],[-51.4102,-14.9963],[-51.3417,-14.9806],[-51.2631,-15.0225],[-51.1853,-14.9775],[-51.0967,-14.8884],[-51.0425,-14.7053],[-50.9676,-14.5262],[-50.9991,-14.4056],[-50.9622,-14.2339],[-50.8598,-14.0411],[-50.8671,-13.7165],[-50.7897,-13.6681],[-50.7236,-13.5031],[-50.5953,-13.3039],[-50.5704,-13.2371],[-50.5806,-13.0661],[-50.5585,-13.0098],[-50.4961,-12.9556],[-50.4841,-12.8449],[-50.4625,-12.8167],[-50.4494,-12.6983],[-50.407,-12.6208],[-50.2914,-12.4898],[-50.257,-12.5783],[-50.335,-12.6967],[-50.3685,-12.8439],[-50.2147,-12.869],[-50.0742,-12.9337],[-49.8224,-12.9588],[-49.624,-13.0664],[-49.3632,-13.1562],[-49.3231,-13.1418],[-49.2183,-12.7685],[-49.1247,-12.6178],[-49.0489,-12.5567],[-48.9754,-12.6394],[-48.9085,-12.7578],[-48.8376,-12.9907],[-48.798,-13.1853],[-48.7251,-13.1886],[-48.6774,-13.1413],[-48.622,-13.0447],[-48.4454,-13.0661],[-48.1553,-13.0328],[-48.1411,-13.0794],[-48.1767,-13.1775],[-47.9761,-13.2693],[-47.7614,-13.3124],[-47.7175,-13.307],[-47.6846,-13.1003],[-47.6497,-13.1019],[-47.5525,-13.2667],[-47.5233,-13.2817],[-47.4094,-13.225],[-47.2475,-13.0946],[-46.9575,-13.0319],[-46.8584,-13.0317],[-46.6944,-12.9624],[-46.5828,-12.8782],[-46.2394,-12.7893],[-46.0648,-12.944],[-46.1555,-13.0341],[-46.1862,-13.1924],[-46.075,-13.2657],[-46.0937,-13.3486],[-46.1956,-13.4134],[-46.2722,-13.6536],[-46.2752,-13.7506],[-46.2353,-13.9711],[-46.1267,-14.1874],[-45.9209,-14.3511],[-45.9699,-14.5111],[-45.9125,-14.6978],[-45.9286,-14.7461],[-46.0232,-14.8689],[-46.0872,-14.932],[-46.2943,-14.9108],[-46.352,-14.8009],[-46.5071,-14.7087],[-46.5822,-14.8015],[-46.5449,-15.0367],[-46.6068,-15.0779],[-46.7849,-15.0074],[-46.8839,-15.0392],[-46.93,-15.2366],[-46.884,-15.243],[-46.8524,-15.3149],[-46.9359,-15.4171],[-46.9333,-15.535],[-46.8723,-15.585],[-46.8282,-15.8493],[-46.8619,-15.8823],[-47.0775,-15.938],[-47.2243,-16.0315],[-47.3051,-16.039]]]},"properties":{"name":"Goiás","id":"BR-GO","CNTRY":"Brazil","TYPE":"State"},"id":"BR-GO"}
{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[7.0921,46.9031],[7.0953,46.9028],[7.0984,46.8995],[7.1046,46.8999],[7.0954,46.8949],[7.0915,46.8917],[7.0846,46.8926],[7.084,46.8957],[7.0895,46.8979],[7.0869,46.9006],[7.0921,46.9031]]],[[[7.1369,46.9137],[7.1363,46.9115],[7.1393,46.9071],[7.1299,46.9051],[7.1206,46.9],[7.1197,46.9052],[7.1143,46.9102],[7.116,46.9157],[7.1271,46.9189],[7.1301,46.918],[7.1356,46.9193],[7.1369,46.9137]]],[[[7.3286,47.4413],[7.3379,47.441],[7.3436,47.4361],[7.3516,47.4342],[7.3693,47.4339],[7.3813,47.4318],[7.3792,47.4213],[7.3758,47.4151],[7.3576,47.4158],[7.3587,47.4185],[7.3528,47.4208],[7.3478,47.4242],[7.3439,47.4252],[7.3409,47.43],[7.3337,47.4309],[7.3261,47.4329],[7.3255,47.4361],[7.3286,47.4413]]],[[[6.8624,47.1661],[6.8632,47.1681],[6.8725,47.1747],[6.8775,47.1618],[6.8807,47.1585],[6.8805,47.1557],[6.8843,47.1504],[6.8928,47.1539],[6.9065,47.1573],[6.9191,47.1649],[6.9305,47.1694],[6.9376,47.1742],[6.9419,47.1843],[6.9531,47.1874],[6.9565,47.181],[6.9627,47.182],[6.9703,47.1815],[6.9765,47.1756],[6.9804,47.1743],[6.9862,47.1778],[6.9944,47.1865],[6.9968,47.1934],[7.0128,47.1939],[7.0244,47.1956],[7.0309,47.202],[7.0377,47.2136],[7.0447,47.2215],[7.0478,47.2266],[7.0592,47.2307],[7.0567,47.2372],[7.0581,47.241],[7.0603,47.2423],[7.0689,47.2438],[7.0797,47.2472],[7.0802,47.243],[7.0852,47.245],[7.0891,47.2411],[7.0868,47.2386],[7.0902,47.2363],[7.0969,47.2367],[7.0969,47.2381],[7.1035,47.2425],[7.1116,47.2413],[7.1284,47.2448],[7.1405,47.2428],[7.1407,47.2438],[7.1555,47.2474],[7.1529,47.2512],[7.1498,47.2531],[7.1499,47.2557],[7.1431,47.2554],[7.1434,47.2592],[7.1464,47.2595],[7.1474,47.2624],[7.1462,47.2652],[7.1501,47.2693],[7.1688,47.2744],[7.1679,47.2798],[7.1701,47.2836],[7.1658,47.2862],[7.1641,47.2936],[7.1696,47.2942],[7.1743,47.2936],[7.1974,47.2956],[7.209,47.2945],[7.2061,47.2917],[7.2105,47.2886],[7.2161,47.2894],[7.221,47.2885],[7.2323,47.2881],[7.2412,47.2854],[7.2583,47.2852],[7.2632,47.2872],[7.2766,47.2841],[7.2918,47.2851],[7.3016,47.2871],[7.316,47.2874],[7.3224,47.2947],[7.3315,47.2988],[7.3378,47.3054],[7.3632,47.3087],[7.3808,47.3152],[7.4059,47.3125],[7.4123,47.3136],[7.4137,47.3104],[7.4225,47.3074],[7.4297,47.3073],[7.442,47.3089],[7.4567,47.3071],[7.476,47.3073],[7.4782,47.3051],[7.4857,47.3021],[7.4949,47.3022],[7.4988,47.303],[7.5259,47.3153],[7.5586,47.3228],[7.5562,47.3236],[7.544,47.3218],[7.5369,47.3216],[7.5286,47.3229],[7.5352,47.3353],[7.5506,47.342],[7.5528,47.346],[7.5613,47.3425],[7.5633,47.3396],[7.5724,47.3302],[7.5719,47.3271],[7.5693,47.3248],[7.5617,47.322],[7.5586,47.3228],[7.549,47.3168],[7.5468,47.3075],[7.5474,47.3067],[7.5394,47.3021],[7.5396,47.2982],[7.5331,47.2943],[7.5209,47.2938],[7.5067,47.2901],[7.4957,47.2879],[7.4953,47.2867],[7.4876,47.2839],[7.4859,47.2842],[7.4757,47.2758],[7.4743,47.272],[7.4676,47.2651],[7.4397,47.2624],[7.4275,47.2559],[7.4175,47.2534],[7.4166,47.2496],[7.4184,47.2449],[7.4212,47.2428],[7.4163,47.2403],[7.4092,47.2393],[7.4016,47.2343],[7.3747,47.2266],[7.3623,47.2187],[7.3576,47.2206],[7.3406,47.217],[7.3448,47.2067],[7.347,47.2069],[7.3546,47.1911],[7.3611,47.1926],[7.3654,47.1952],[7.3676,47.1909],[7.3785,47.1866],[7.3856,47.177],[7.3918,47.1663],[7.3905,47.165],[7.3831,47.1651],[7.3842,47.1598],[7.3931,47.1599],[7.4034,47.1625],[7.4088,47.1616],[7.4128,47.162],[7.4164,47.1648],[7.419,47.1709],[7.4305,47.1741],[7.4323,47.1758],[7.4314,47.1818],[7.4323,47.1835],[7.4372,47.1851],[7.4418,47.1793],[7.4475,47.1804],[7.4507,47.1836],[7.4491,47.1892],[7.4563,47.1886],[7.4759,47.1904],[7.477,47.1877],[7.4735,47.1847],[7.4761,47.1774],[7.4788,47.1743],[7.4844,47.1728],[7.4865,47.1735],[7.4972,47.17],[7.4903,47.1657],[7.493,47.163],[7.485,47.1594],[7.4796,47.1547],[7.4757,47.153],[7.4673,47.1511],[7.4603,47.1531],[7.4579,47.1551],[7.4507,47.1555],[7.4401,47.1502],[7.4399,47.1434],[7.4332,47.1433],[7.4261,47.1403],[7.427,47.138],[7.4243,47.1344],[7.4273,47.1308],[7.4304,47.1291],[7.4357,47.1308],[7.4359,47.128],[7.4399,47.1243],[7.4356,47.1235],[7.429,47.1239],[7.4226,47.1212],[7.4155,47.1214],[7.4046,47.1177],[7.3959,47.1215],[7.3907,47.1195],[7.3864,47.1253],[7.3825,47.1225],[7.3792,47.1238],[7.3709,47.1211],[7.3718,47.1183],[7.37,47.1157],[7.3746,47.1122],[7.3762,47.1085],[7.3792,47.1061],[7.3823,47.0992],[7.3825,47.0958],[7.3896,47.0949],[7.3904,47.0916],[7.4118,47.095],[7.4208,47.0989],[7.4236,47.0974],[7.4335,47.1002],[7.4364,47.0947],[7.4334,47.0871],[7.4349,47.0858],[7.4357,47.08],[7.4414,47.0763],[7.4419,47.0741],[7.4539,47.0757],[7.4565,47.0748],[7.459,47.0776],[7.4685,47.0789],[7.4721,47.0842],[7.4754,47.0849],[7.475,47.0877],[7.4677,47.0943],[7.4622,47.1035],[7.4619,47.1079],[7.4915,47.1166],[7.4994,47.1214],[7.5055,47.1226],[7.5111,47.1261],[7.5144,47.1301],[7.5143,47.1332],[7.5202,47.1407],[7.524,47.1422],[7.5242,47.1458],[7.5296,47.1481],[7.5286,47.1514],[7.5251,47.1537],[7.5222,47.1583],[7.5235,47.1609],[7.5347,47.1641],[7.5352,47.1625],[7.5414,47.1634],[7.5443,47.1602],[7.5465,47.1605],[7.5592,47.168],[7.563,47.1681],[7.5679,47.1632],[7.5757,47.1639],[7.58,47.1605],[7.5833,47.1556],[7.5862,47.1479],[7.5905,47.1518],[7.5983,47.1517],[7.6069,47.1528],[7.6146,47.1546],[7.6166,47.1566],[7.6244,47.1527],[7.6356,47.1527],[7.6403,47.1537],[7.6444,47.1493],[7.652,47.1505],[7.6528,47.1525],[7.6509,47.1571],[7.6522,47.1621],[7.6598,47.1688],[7.6658,47.1694],[7.6736,47.1689],[7.6744,47.1758],[7.6771,47.1781],[7.6779,47.1831],[7.6721,47.1876],[7.675,47.1905],[7.668,47.1967],[7.6641,47.1983],[7.6621,47.2016],[7.6579,47.2011],[7.6486,47.202],[7.6515,47.2069],[7.6467,47.2154],[7.6461,47.2196],[7.6401,47.2232],[7.6438,47.225],[7.6406,47.2295],[7.6358,47.227],[7.6262,47.2266],[7.6249,47.23],[7.6194,47.2291],[7.6141,47.2368],[7.6066,47.2395],[7.5992,47.2453],[7.5962,47.2461],[7.5982,47.2545],[7.5942,47.2663],[7.5876,47.2697],[7.5806,47.2761],[7.5828,47.2771],[7.6176,47.2818],[7.6436,47.2821],[7.6534,47.2834],[7.6623,47.2877],[7.6688,47.2892],[7.6707,47.2882],[7.6784,47.2901],[7.6851,47.2944],[7.6895,47.2907],[7.7017,47.2871],[7.7052,47.2826],[7.7091,47.2809],[7.7107,47.2768],[7.7135,47.2752],[7.7159,47.2774],[7.726,47.2696],[7.7256,47.2667],[7.7333,47.2597],[7.7395,47.2602],[7.7445,47.2577],[7.7526,47.2598],[7.7595,47.2599],[7.7657,47.2671],[7.7751,47.2681],[7.7767,47.2617],[7.7846,47.258],[7.7863,47.2563],[7.7943,47.2616],[7.8007,47.2678],[7.8056,47.2685],[7.8075,47.2637],[7.8153,47.2615],[7.8193,47.2625],[7.8277,47.2665],[7.8294,47.2574],[7.8283,47.2507],[7.8323,47.2392],[7.8383,47.2317],[7.8382,47.23],[7.8431,47.2212],[7.8476,47.2168],[7.8492,47.2112],[7.8568,47.2004],[7.8597,47.1978],[7.8655,47.188],[7.8712,47.1845],[7.8772,47.1723],[7.8762,47.1629],[7.8779,47.1533],[7.8807,47.149],[7.8904,47.1407],[7.8908,47.138],[7.8871,47.1317],[7.8871,47.1289],[7.8705,47.1214],[7.868,47.1169],[7.87,47.1159],[7.869,47.1119],[7.8751,47.1104],[7.8733,47.1047],[7.8761,47.1023],[7.8754,47.099],[7.8802,47.0948],[7.882,47.0888],[7.8784,47.0746],[7.8767,47.0704],[7.8722,47.0633],[7.8749,47.0619],[7.8669,47.0538],[7.8697,47.0471],[7.8751,47.0414],[7.8821,47.0408],[7.8842,47.0373],[7.8837,47.0345],[7.8939,47.0286],[7.8945,47.0234],[7.9009,47.0185],[7.8976,47.0142],[7.902,47.0069],[7.9208,47.0109],[7.925,47.011],[7.9272,47.0074],[7.9333,47.0045],[7.9405,47.0061],[7.9479,47.0062],[7.9506,47.0071],[7.9558,47.0042],[7.953,46.9977],[7.9494,46.9942],[7.953,46.9815],[7.9454,46.9772],[7.9467,46.9685],[7.9414,46.965],[7.9389,46.9647],[7.9328,46.9612],[7.9328,46.9514],[7.9305,46.9484],[7.9222,46.9462],[7.9223,46.9432],[7.9148,46.9334],[7.9058,46.9331],[7.8995,46.9349],[7.8917,46.9331],[7.8854,46.9297],[7.8774,46.9277],[7.8736,46.9253],[7.868,46.9163],[7.8679,46.9149],[7.8768,46.9107],[7.8808,46.9099],[7.8833,46.9042],[7.8794,46.8988],[7.8689,46.887],[7.8619,46.8863],[7.8574,46.882],[7.8588,46.8772],[7.8585,46.8716],[7.8645,46.8702],[7.8666,46.8662],[7.8704,46.8641],[7.8684,46.8598],[7.8684,46.8508],[7.8712,46.8479],[7.8709,46.8449],[7.8794,46.8365],[7.9009,46.8292],[7.9237,46.8196],[7.9473,46.8052],[7.952,46.7995],[7.9557,46.7908],[7.9618,46.7888],[7.964,46.7868],[7.9684,46.7857],[7.9714,46.7809],[7.9751,46.7783],[7.9823,46.7768],[7.9863,46.775],[7.9961,46.7778],[7.9989,46.7817],[8.0047,46.7823],[8.0161,46.7854],[8.0229,46.7891],[8.0351,46.7895],[8.0434,46.7874],[8.0501,46.7876],[8.0548,46.7882],[8.0603,46.7865],[8.0668,46.7871],[8.0716,46.7888],[8.077,46.786],[8.0906,46.7869],[8.0969,46.7802],[8.1029,46.7765],[8.1037,46.7733],[8.1131,46.7733],[8.1205,46.7704],[8.1233,46.7701],[8.1472,46.7549],[8.1539,46.7576],[8.1598,46.759],[8.169,46.7644],[8.173,46.7639],[8.1908,46.7699],[8.1969,46.768],[8.2113,46.7693],[8.2145,46.7654],[8.2235,46.7609],[8.2334,46.7613],[8.2352,46.7622],[8.2407,46.7704],[8.245,46.7678],[8.2489,46.7676],[8.2534,46.7653],[8.2606,46.7643],[8.2694,46.7563],[8.27,46.7539],[8.2748,46.7544],[8.284,46.7529],[8.2933,46.7579],[8.2977,46.7593],[8.2996,46.7617],[8.3047,46.7618],[8.312,46.7679],[8.3375,46.7805],[8.354,46.7824],[8.3607,46.7823],[8.3649,46.7856],[8.3699,46.7876],[8.3719,46.7881],[8.3792,46.7857],[8.3834,46.7802],[8.3922,46.7775],[8.3963,46.7719],[8.3978,46.7653],[8.4096,46.7703],[8.4158,46.7746],[8.4202,46.7735],[8.4226,46.7703],[8.4306,46.7722],[8.4395,46.7723],[8.4421,46.7708],[8.4489,46.7708],[8.446,46.7666],[8.4494,46.7641],[8.4482,46.7587],[8.4448,46.7538],[8.44,46.7533],[8.4446,46.7479],[8.4415,46.7429],[8.4422,46.7373],[8.4513,46.7305],[8.4484,46.7261],[8.449,46.7142],[8.4561,46.7103],[8.4536,46.7048],[8.4562,46.6997],[8.4535,46.689],[8.4411,46.6859],[8.4342,46.6873],[8.4291,46.6866],[8.4146,46.6913],[8.4005,46.6929],[8.4005,46.6881],[8.399,46.6834],[8.4006,46.681],[8.3988,46.6754],[8.4022,46.6723],[8.4043,46.6687],[8.4091,46.6667],[8.4117,46.6533],[8.4001,46.6547],[8.3955,46.6454],[8.3908,46.6446],[8.381,46.6348],[8.3731,46.6337],[8.3702,46.6265],[8.37,46.621],[8.3724,46.6199],[8.3723,46.6158],[8.3703,46.61],[8.3634,46.6027],[8.3624,46.5986],[8.365,46.594],[8.3622,46.5886],[8.3625,46.5863],[8.3682,46.5849],[8.3614,46.5782],[8.3544,46.5743],[8.3517,46.5689],[8.3478,46.5658],[8.3357,46.5609],[8.3198,46.5596],[8.317,46.5587],[8.3144,46.5533],[8.3052,46.5461],[8.2953,46.5451],[8.2892,46.5431],[8.2847,46.5381],[8.2798,46.536],[8.2721,46.5357],[8.2663,46.5339],[8.2591,46.5297],[8.2529,46.5292],[8.2431,46.5264],[8.2399,46.5272],[8.2348,46.5265],[8.2268,46.5269],[8.209,46.5244],[8.2063,46.5229],[8.2028,46.5238],[8.1915,46.5226],[8.1855,46.52],[8.1746,46.5248],[8.1758,46.5313],[8.1644,46.5314],[8.1615,46.5298],[8.1587,46.531],[8.1493,46.5324],[8.1414,46.5353],[8.1286,46.5369],[8.1251,46.5385],[8.1161,46.5465],[8.1073,46.5487],[8.1032,46.5484],[8.0979,46.5494],[8.095,46.5517],[8.0912,46.5513],[8.0852,46.5522],[8.0773,46.5559],[8.0709,46.5539],[8.0633,46.5527],[8.055,46.5564],[8.0447,46.5572],[8.0374,46.5598],[8.0333,46.5627],[8.0259,46.5623],[8.0168,46.5635],[8.0136,46.5629],[8.0027,46.558],[7.9978,46.5588],[7.9858,46.5468],[7.9821,46.5483],[7.9758,46.5473],[7.9721,46.5455],[7.9696,46.5426],[7.9639,46.5398],[7.9637,46.5371],[7.968,46.5308],[7.9737,46.5245],[7.9713,46.5201],[7.9723,46.5186],[7.9681,46.5137],[7.9646,46.5127],[7.9551,46.5077],[7.9517,46.5087],[7.9429,46.5075],[7.9362,46.5036],[7.9333,46.4984],[7.9248,46.4952],[7.9248,46.492],[7.9177,46.4915],[7.9126,46.4869],[7.9083,46.4872],[7.9067,46.4854],[7.902,46.4847],[7.8993,46.4827],[7.8929,46.4833],[7.886,46.4804],[7.8788,46.479],[7.8776,46.4772],[7.8721,46.4783],[7.8554,46.478],[7.8481,46.4795],[7.8424,46.476],[7.8295,46.4715],[7.8247,46.4665],[7.7985,46.4587],[7.7947,46.4543],[7.7884,46.4524],[7.7862,46.4498],[7.7813,46.4474],[7.7786,46.4436],[7.7727,46.4424],[7.7704,46.4394],[7.7665,46.4399],[7.7652,46.4375],[7.758,46.4351],[7.7565,46.4333],[7.7478,46.4301],[7.7426,46.4266],[7.7361,46.4237],[7.7236,46.4213],[7.7188,46.4185],[7.7168,46.4156],[7.7113,46.4144],[7.7083,46.415],[7.7038,46.4187],[7.6951,46.4236],[7.6937,46.4256],[7.6899,46.4252],[7.6831,46.4271],[7.678,46.4298],[7.6354,46.4414],[7.6272,46.4459],[7.6217,46.4397],[7.6186,46.4384],[7.6109,46.4372],[7.6089,46.4346],[7.6106,46.4285],[7.6051,46.4237],[7.5993,46.4223],[7.6005,46.4159],[7.5978,46.4149],[7.5954,46.4117],[7.5857,46.4151],[7.5839,46.4173],[7.5767,46.4171],[7.5726,46.4152],[7.5646,46.4137],[7.5543,46.4138],[7.5513,46.4125],[7.5408,46.4117],[7.5337,46.4095],[7.5333,46.4071],[7.5287,46.4003],[7.5356,46.3964],[7.5485,46.3932],[7.5557,46.389],[7.5424,46.3844],[7.5391,46.3808],[7.5393,46.3777],[7.5273,46.3747],[7.5135,46.3761],[7.5076,46.3758],[7.5058,46.3728],[7.4998,46.3698],[7.4941,46.3718],[7.4881,46.3703],[7.4855,46.3723],[7.4857,46.3753],[7.483,46.3822],[7.4797,46.3848],[7.4734,46.3835],[7.4699,46.378],[7.4646,46.3779],[7.4622,46.3763],[7.4589,46.3782],[7.4598,46.3814],[7.4539,46.3819],[7.4503,46.3811],[7.444,46.3824],[7.4388,46.386],[7.4266,46.38],[7.4137,46.3788],[7.4011,46.3738],[7.3996,46.3759],[7.3935,46.3731],[7.3823,46.3648],[7.378,46.3641],[7.3752,46.3614],[7.3662,46.3564],[7.3628,46.3558],[7.3543,46.35],[7.3483,46.3504],[7.3383,46.3466],[7.3237,46.3439],[7.3156,46.3437],[7.3087,46.3507],[7.3101,46.3553],[7.3086,46.3583],[7.3125,46.3626],[7.3127,46.3707],[7.3107,46.3745],[7.2977,46.3649],[7.2905,46.3665],[7.2717,46.3608],[7.2668,46.3579],[7.2625,46.358],[7.2608,46.3544],[7.262,46.3521],[7.2613,46.3396],[7.2629,46.338],[7.2524,46.3295],[7.2416,46.3266],[7.2323,46.326],[7.2216,46.3289],[7.222,46.3465],[7.219,46.3567],[7.2264,46.358],[7.2293,46.3608],[7.2256,46.3643],[7.2182,46.3615],[7.2156,46.362],[7.2108,46.3676],[7.2095,46.372],[7.2074,46.3732],[7.2074,46.3769],[7.2038,46.3783],[7.1936,46.3784],[7.1939,46.3824],[7.1984,46.3903],[7.2011,46.3928],[7.2047,46.3999],[7.2077,46.4029],[7.2073,46.4098],[7.2097,46.4158],[7.206,46.421],[7.2023,46.4229],[7.1993,46.4286],[7.1926,46.4341],[7.1949,46.4405],[7.2038,46.4401],[7.2044,46.4389],[7.2142,46.4395],[7.2217,46.4414],[7.2257,46.4444],[7.2268,46.4488],[7.2261,46.4515],[7.2323,46.4537],[7.2267,46.4575],[7.2296,46.4601],[7.2289,46.4619],[7.2311,46.4661],[7.2257,46.4758],[7.2242,46.4866],[7.2362,46.4881],[7.2355,46.4927],[7.2327,46.4948],[7.2396,46.4958],[7.244,46.5],[7.2448,46.5047],[7.2487,46.5107],[7.2473,46.5139],[7.2493,46.5175],[7.2468,46.5311],[7.2453,46.5327],[7.2459,46.5381],[7.2448,46.5401],[7.2375,46.5465],[7.2372,46.5541],[7.2433,46.5551],[7.2563,46.5603],[7.2729,46.5784],[7.2818,46.585],[7.2848,46.585],[7.2877,46.5827],[7.2975,46.5802],[7.3023,46.5802],[7.3087,46.5825],[7.3128,46.5896],[7.3211,46.5923],[7.3156,46.6007],[7.3182,46.6188],[7.3126,46.622],[7.3136,46.6361],[7.3156,46.6369],[7.3246,46.6376],[7.3297,46.6418],[7.3285,46.6459],[7.3216,46.6549],[7.3461,46.6555],[7.3503,46.6521],[7.3522,46.6476],[7.3556,46.6459],[7.3559,46.6416],[7.3628,46.6478],[7.3683,46.6503],[7.3769,46.6559],[7.3698,46.6558],[7.3728,46.6671],[7.3715,46.6696],[7.3765,46.6753],[7.3733,46.68],[7.3782,46.6834],[7.3764,46.6874],[7.3805,46.6901],[7.3774,46.6926],[7.3691,46.6925],[7.361,46.6979],[7.3462,46.6986],[7.3466,46.7015],[7.35,46.7052],[7.3508,46.7085],[7.3499,46.7122],[7.332,46.7148],[7.3238,46.7169],[7.3083,46.717],[7.3001,46.7224],[7.2966,46.7298],[7.2989,46.739],[7.2983,46.7403],[7.304,46.7434],[7.3055,46.7457],[7.3039,46.7515],[7.3043,46.7585],[7.2961,46.7649],[7.2914,46.7726],[7.2962,46.775],[7.3007,46.7801],[7.3053,46.7829],[7.3025,46.7851],[7.3042,46.7892],[7.302,46.7928],[7.3059,46.795],[7.3111,46.8086],[7.3143,46.81],[7.3161,46.8129],[7.3205,46.8147],[7.3189,46.8169],[7.3214,46.8204],[7.3205,46.8257],[7.3291,46.8286],[7.3321,46.832],[7.3299,46.8349],[7.3227,46.8405],[7.3084,46.8462],[7.3066,46.85],[7.3029,46.8517],[7.3125,46.8553],[7.3131,46.8604],[7.3223,46.861],[7.3282,46.8597],[7.3236,46.8545],[7.3261,46.8514],[7.3319,46.8507],[7.3346,46.8521],[7.3385,46.8492],[7.3483,46.8535],[7.35,46.8532],[7.3547,46.8571],[7.355,46.8587],[7.36,46.8624],[7.3584,46.8647],[7.3584,46.8694],[7.3548,46.8705],[7.353,46.8753],[7.3543,46.8859],[7.3492,46.889],[7.3262,46.8933],[7.3087,46.8911],[7.2962,46.8933],[7.2879,46.8927],[7.2829,46.8891],[7.2799,46.8893],[7.2733,46.892],[7.2665,46.8934],[7.261,46.8973],[7.2448,46.8999],[7.2442,46.8975],[7.237,46.8972],[7.2299,46.9004],[7.2293,46.9025],[7.2246,46.9025],[7.2189,46.8975],[7.2133,46.9014],[7.2101,46.9023],[7.2046,46.9016],[7.2007,46.9022],[7.196,46.8985],[7.1892,46.8999],[7.2002,46.9035],[7.2086,46.9088],[7.2065,46.9143],[7.2077,46.9172],[7.2059,46.9214],[7.2074,46.9246],[7.2121,46.9249],[7.2135,46.9282],[7.2039,46.9376],[7.2041,46.9396],[7.2108,46.9425],[7.2111,46.947],[7.2089,46.9491],[7.21,46.9541],[7.2118,46.9565],[7.2079,46.9596],[7.2011,46.9591],[7.1953,46.9612],[7.1962,46.9638],[7.2074,46.9641],[7.2081,46.9674],[7.215,46.9668],[7.2151,46.9713],[7.2231,46.9743],[7.2222,46.9756],[7.2291,46.9784],[7.2344,46.9837],[7.2346,46.9876],[7.2285,46.9913],[7.223,46.9934],[7.2274,46.997],[7.224,46.9981],[7.2225,47.0021],[7.2171,47.0067],[7.2131,47.0064],[7.2108,47.0042],[7.2058,47.0064],[7.1975,47.0001],[7.1566,46.9859],[7.1537,46.9858],[7.0946,46.9761],[7.0603,46.9767],[7.0504,46.9776],[7.0414,46.9794],[7.0289,47.002],[7.0255,47.0062],[7.0317,47.0117],[7.0342,47.0172],[7.0339,47.0312],[7.0389,47.0364],[7.0509,47.0429],[7.0645,47.0447],[7.0778,47.0509],[7.0871,47.059],[7.0874,47.0606],[7.0813,47.0665],[7.0807,47.0732],[7.0773,47.076],[7.0875,47.0814],[7.0872,47.0857],[7.0787,47.0934],[7.0768,47.0962],[7.0659,47.0987],[7.0575,47.0996],[7.0487,47.1054],[7.0408,47.109],[7.0292,47.1036],[7.024,47.112],[7.0308,47.1194],[7.0404,47.1247],[7.0382,47.1263],[7.0304,47.1274],[7.0263,47.1243],[7.0115,47.1232],[7.0078,47.1243],[6.997,47.1193],[6.9889,47.1174],[6.9521,47.1131],[6.942,47.1098],[6.9375,47.1091],[6.9303,47.1131],[6.9275,47.1097],[6.9185,47.1052],[6.8672,47.0855],[6.8727,47.1034],[6.8816,47.1089],[6.8891,47.1317],[6.8624,47.1661]],[[7.231,46.937],[7.2187,46.9331],[7.2158,46.9303],[7.2191,46.924],[7.2251,46.9269],[7.2269,46.9267],[7.2346,46.9292],[7.2347,46.9357],[7.231,46.937]],[[7.6969,47.1582],[7.7005,47.1624],[7.6954,47.1626],[7.6917,47.1665],[7.6892,47.167],[7.6817,47.1627],[7.6797,47.1635],[7.6748,47.1549],[7.6904,47.1536],[7.6949,47.1585],[7.6969,47.1582]]]]},"properties":{"name":"Bern","id":"CH-BE","CNTRY":"Switzerland","TYPE":"Canton"},"id":"CH-BE"}
Данные GeoJSON для этих областей определены как полигоны типа геометрии или мультиполигоны. Но в обоих случаях, когда команда
decode(json_line)
запускается, чтобы геометрия могла быть возвращена в виде текста и сохранена в PostGIS
geometry.as_text
генерируется следующая ошибка:
RGeo::Error::InvalidGeometry: LinearRing failed ring test
что я интерпретирую как то, что полигон не закрывается. Это так, но со складкой.
Как можно справиться с этим кольцом с кольцом в нем?
Комментарии:
1. Можете ли вы опубликовать свой GeoJSON?
2. вопрос исправлен
Ответ №1:
После просмотра всех геокоординат и тестирования строки можно сделать вывод, что этот вопрос не связан с наличием пустого многоугольника внутри многоугольника.
Скорее, при увеличении масштаба данных появляется область (в случае Берна, крошечной деревушки Шельтен), которая является островом немецкоговорящих во французском регионе Юра, который, похоже, решил стать частью нефранцузского кантона. Однако полигон, который его содержит, определяет его как расширение гораздо большего полигона, создавая пересечение и, следовательно LinearRing
, ошибку.
В принципе, у полигона не может быть точек, которые касаются его собственных ребер.
Проблема бернского решается путем извлечения этой области пересечения в ее собственный полигон…