missinglink / pbf

utilities for parsing OpenStreetMap PBF files and extracting geographic data
MIT License
21 stars 9 forks source link

Street merging won't merge related street #34

Open arnesetzer opened 1 year ago

arnesetzer commented 1 year ago

First of all: I'm not sure whether that is a data problem, code problem or a layer 8 problem.

If I want to get all streets from munich the tools always generates 8 parts for the "Dachauer Straße" instead of two (the street is split in two parts for some reasons)

I used this extract as basis: https://app.protomaps.com/downloads/osm/8d65d011-2e9e-4ed9-a21a-f4eaabda4b76

Here is the result

Munich.polyline ``` mxyyzAq_n`UyIp@oCNoETgFf@yDxA{DlAsDpAkD`B}ClBmBzAsEhDiCjDpHxDpDqB`I_E~F}BdEuAxC_AtDcAzFyA`PaEbcAqPNCh`@sHdTwDnFRjBL~Fn@vAsOW@_GZgFv@cPpCeGfAw_@~GiPvCss@lMoC\eTjPrD}@fA[oGyJgFf@Dachauer Straße qwsyzA_co`UmBvAaAfAbRzJDoBSqCIoCXmCp@sC`A}Bn@gAn@iA??yABM@}J~EcD`EhCt\pDeAx@mAj@{BPiCtEc]tM{BfMyBfr@wL|Du@??|Do@rNiCbU_EbHmA|@O??p@MjDo@pIwAnCe@~M_CdHoAjHoAn`@yGdHmApI{ApBa@dSyE~FgBzL}ERIxT{IlFkDlDoDDachauer Straße }vm|zA{a`}Tc@dMKrBm@lP{AhUoH~t@??cVdfCiIfw@qDdXqBpM{CbLqDdLi@~AoHlQsB~EgDsE`CcFn@oAp@uAdJ}U`DgMbCmM??hFq[bImu@jTk|B`Da_@jCq^lCei@f@_MpEf@aBOoBWpEf@lGn@fAHpRbBfH@~IeA??lHkBhHiCrJgD??fBm@`\qKtVsFnVoF`L}BhB]zGuAjIaBbI_B|Co@XGrOeDlDu@lLgClH}AdE{@dIaBpFmAvDu@rGqA`AQlFeA~y@gRrj@eMjPaE`MaEtC}@|HyBnFgCxDwCtFkGxc@wp@??nByC`@o@dFqIjGmK|To`@pTs_@pAcC|FuKvFgMlE_MzIwWpPug@~C_JdEmK??lTyf@xEbGp\ew@l@uCP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yg_@~BsXcUjWDachauer Straße mpt}zAs`~{TmHhGcGdGcAjAkc@hh@mC~CuBdCeMbXudAxlAqGnHcO|PsOnQgQ`TuRpLgGzGyH|Ig@l@aBhB??gBpBzAlDbBqB_E{@yBdCm@r@}DrE}KhMgb@pg@mI`KsFbGbEx@wWr[yeAzlAoLtOsIjMrIkMc@aFuItKtIuKd\k`@ziAqsAbEx@lC_DtDkEbEkF~PkS~NqPvIiKhFiG~@gAzBiCbBqB|AgBdFaGtQ{RnIkKuRpLfEsEh\g`@tO{Q|N{PjC}Chc@qg@h`@od@pLiNn@u@zD{En@vFrA}AzI_KvDkEdJwK~LgO`KcJ`CgBbDcCjAcLNGrB_AlQaIvQqFfFe@fJoAxBbI`Qu@}NgH}DXzTlGnu@sAfM]lFOdF[|Jm@r@E|WkCne@kKpK{EbFkBaSkBce@`KoB^sGtAyKrM|WkCcKgI}GjBsQvAiJRoA?iHXaNh@aCDuo@pAeFHcA|IeH`@kOzBwHbCi[jCkDxC~AhGpEcC|JiFfJuD\KDachauer Straße iie{zAuat~T|@uBt@gBbB}DdS{c@z@kBdZoj@}E_JfB`DtB|DnE{InJ}RvT}a@zV{d@tXae@jGcLhCkElGsLaStFeBtCyApCuO`Zk`@nu@wa@|u@oEjI_Zrk@cEfIqSvc@yElLcG`OaA`CsCxHhHdDlBqE`JqTn@wA\u@Dachauer Straße ecazzAqyf`UoA`Bw[jb@_C`DgDvE??iE`GgFzH{CdFtAfNdJ}MlCsEjD_GzEaIjVy\fB{BlPoSuNdBxQyUfYs^lMqAvW}[l@u@zIwKb[u`@|OsS~MsPn@w@|F_InBwBtBoCqHyDuU~[qK|NoGxIg_@be@iIdKi_@rd@lMqAyj@xt@Dachauer Straße ```
munich.geojson ``` {"type":"FeatureCollection","Features":[{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.5584091,48.1499114],[11.5583842,48.150084],[11.5583764,48.1501558],[11.5583653,48.1502601],[11.5583447,48.1503759],[11.5582996,48.1504689],[11.5582613,48.1505634],[11.5582197,48.1506529],[11.5581709,48.1507387],[11.5581161,48.150818],[11.5580701,48.150873],[11.5579849,48.1509794],[11.5578985,48.1510481],[11.557806,48.1508945],[11.5578633,48.1508063],[11.5579594,48.150645],[11.5580222,48.1505174],[11.5580647,48.1504176],[11.5580965,48.1503411],[11.5581306,48.1502496],[11.5581755,48.1501235],[11.5582729,48.149851],[11.5585535,48.1487609],[11.5585556,48.1487526],[11.5587097,48.14822],[11.5588022,48.1478814],[11.558792,48.1477605],[11.558785,48.1477066],[11.5587614,48.1475789],[11.5590271,48.1475353],[11.5590259,48.1475467],[11.5590116,48.1476746],[11.5589838,48.147791],[11.5589114,48.1480645],[11.558875,48.1481961],[11.5587306,48.1487202],[11.5586549,48.1489968],[11.5584244,48.1498386],[11.5584091,48.1499114],[11.5581306,48.1502496],[11.5581623,48.1501603],[11.5581755,48.1501235],[11.5583653,48.1502601],[11.5583447,48.1503759]]},"properties":null},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.5589764,48.1468252],[11.5589319,48.1468798],[11.5588963,48.1469127],[11.558706,48.1466072],[11.5587621,48.1466041],[11.5588346,48.1466138],[11.558907,48.1466185],[11.5589781,48.1466055],[11.5590518,48.1465808],[11.5591151,48.1465476],[11.5591509,48.146524],[11.5591877,48.1464997],[11.5591877,48.1464997],[11.5591855,48.1465452],[11.5591851,48.1465524],[11.5590729,48.1467432],[11.5589764,48.1468252],[11.5585014,48.1467564],[11.5585363,48.1466671],[11.5585752,48.1466383],[11.5586365,48.1466156],[11.558706,48.1466072],[11.5591877,48.1464997],[11.5592504,48.146265],[11.5593113,48.146037],[11.5595305,48.1452165],[11.5595575,48.145122],[11.5595575,48.145122],[11.5595824,48.145027],[11.5596506,48.1447774],[11.5597471,48.1444225],[11.5597862,48.1442765],[11.5597943,48.1442464],[11.5597943,48.1442464],[11.559801,48.1442211],[11.5598254,48.1441347],[11.5598689,48.1439656],[11.5598879,48.1438941],[11.5599521,48.1436542],[11.5599918,48.1435068],[11.5600316,48.143357],[11.5601734,48.1428213],[11.5602124,48.142674],[11.5602583,48.1425054],[11.560275,48.1424483],[11.5603842,48.1421246],[11.5604364,48.1419973],[11.5605469,48.1417748],[11.5605519,48.1417647],[11.5607259,48.1414157],[11.5608118,48.1412967],[11.5609004,48.1412102]]},"properties":null},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.5021255,48.1928948],[11.5018986,48.1929127],[11.5018414,48.1929186],[11.5015618,48.1929423],[11.501205,48.1929881],[11.5003414,48.1931396],[11.5003414,48.1931396],[11.498178,48.19351],[11.4972781,48.1936753],[11.4968745,48.1937639],[11.4966422,48.1938213],[11.496432,48.1938989],[11.4962206,48.1939878],[11.4961731,48.194009],[11.4958775,48.1941609],[11.4957655,48.1942193],[11.495872,48.1943029],[11.4959855,48.1942377],[11.4960255,48.1942144],[11.4960694,48.1941888],[11.4964356,48.1940097],[11.496664,48.1939293],[11.4968946,48.1938625],[11.4968946,48.1938625],[11.4973518,48.1937459],[11.4982228,48.1935841],[11.5002285,48.1932415],[11.5007423,48.1931614],[11.501247,48.1930906],[11.5019216,48.1930204],[11.5021463,48.1929997],[11.5021255,48.1928948],[11.5021341,48.1929438],[11.5021463,48.1929997],[11.5021255,48.1928948],[11.502102,48.1927601],[11.502097,48.1927236],[11.5020469,48.1924105],[11.5020464,48.192263],[11.5020813,48.1920874],[11.5020813,48.1920874],[11.5021351,48.1919357],[11.5022037,48.1917869],[11.5022878,48.1916012],[11.5022878,48.1916012],[11.5023112,48.1915493],[11.5025116,48.1910844],[11.5026336,48.1907046],[11.5027542,48.190329],[11.5028165,48.1901203],[11.5028324,48.1900668],[11.5028747,48.1899249],[11.5029243,48.1897588],[11.5029724,48.1895974],[11.5029962,48.1895179],[11.5029999,48.1895053],[11.503083,48.1892394],[11.5031103,48.1891522],[11.5031776,48.1889369],[11.5032248,48.1887861],[11.5032549,48.1886867],[11.5033042,48.1885242],[11.5033427,48.1884028],[11.5033697,48.1883112],[11.5034106,48.1881728],[11.5034202,48.1881399],[11.5034547,48.1880213],[11.5037625,48.1870774],[11.5039897,48.1863791],[11.5040865,48.1861005],[11.5041835,48.1858755],[11.504215,48.1858006],[11.5042755,48.1856415],[11.5043437,48.1855223],[11.5044202,48.1854286],[11.504554,48.1853056],[11.5053497,48.184717],[11.5053497,48.184717],[11.5054269,48.1846611],[11.5054513,48.1846444],[11.5056198,48.1845291],[11.5058186,48.1843948],[11.5063548,48.1840436],[11.5068773,48.1836986],[11.5069425,48.1836575],[11.5071458,48.183531],[11.5073736,48.1834069],[11.5075981,48.1833037],[11.507994,48.1831297],[11.508645,48.1828487],[11.5088209,48.1827691],[11.5090196,48.1826696],[11.5090196,48.1826696],[11.5096569,48.1823268],[11.5095269,48.1822181],[11.5104259,48.181745],[11.5105006,48.1817215],[11.5105672,48.1817128],[11.5106752,48.1817297],[11.5106752,48.1817297],[11.5112615,48.1813748],[11.5116489,48.1811291],[11.5115075,48.1812423],[11.5113921,48.1812957],[11.5113921,48.1812957],[11.5113988,48.1812609],[11.5114107,48.181199],[11.5114208,48.1811576],[11.5114414,48.1810727],[11.5114456,48.1810429],[11.5114473,48.1810143],[11.5114473,48.1810143],[11.5114869,48.1809639],[11.5115208,48.1809313],[11.5115389,48.1809214],[11.51225,48.1805283],[11.5127313,48.1802622],[11.5129385,48.1801535],[11.5134642,48.1798647],[11.5142425,48.1794783],[11.5148534,48.1791787],[11.5149344,48.1791403],[11.5150691,48.1790801],[11.5150691,48.1790801],[11.515176,48.1790343],[11.5166288,48.1783422],[11.5171534,48.1780819],[11.5176913,48.1778207],[11.5183269,48.1775024],[11.51909,48.1771271],[11.5204042,48.1764489],[11.5204684,48.1764168],[11.5212758,48.1760204],[11.5215616,48.1758761],[11.5216374,48.1758379],[11.5217452,48.1757826],[11.5217452,48.1757826],[11.5219929,48.1756556],[11.5220048,48.1759216],[11.5219075,48.175975],[11.5215829,48.1761405],[11.5206432,48.1765566],[11.5204445,48.1766524],[11.5192195,48.1772397],[11.5181896,48.1777323],[11.5173736,48.1781399],[11.5169182,48.1783674],[11.5160472,48.1788024],[11.5153975,48.179127],[11.5153146,48.1791684],[11.515212,48.1792205],[11.515082,48.1792865],[11.5148343,48.1794028],[11.5147036,48.1794644],[11.5144177,48.1795822],[11.5142338,48.1796601],[11.5140548,48.1797458],[11.5132375,48.1801497],[11.5128569,48.1803573],[11.5126878,48.1804553],[11.512349,48.1806518],[11.5122997,48.1806804],[11.5117853,48.180995],[11.5117274,48.1810517],[11.5116489,48.1811291],[11.5112615,48.1813748],[11.5113921,48.1812957]]},"properties":null},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.491389,48.2014803],[11.4912847,48.2016002],[11.4908166,48.2021387],[11.4908166,48.2021387],[11.486401,48.2072169],[11.4862911,48.2073458],[11.486401,48.2072169],[11.4864938,48.2072587],[11.4914428,48.2016511],[11.4915441,48.2015359],[11.491389,48.2014803],[11.4921401,48.2006608],[11.4924534,48.2003347],[11.4932381,48.1996238],[11.4932381,48.1996238],[11.4932984,48.199568],[11.4932984,48.199568],[11.4938766,48.1990146],[11.4941948,48.1986362],[11.4941948,48.1986362],[11.4943566,48.1983737],[11.4944937,48.1980914],[11.494641,48.197601],[11.4946902,48.1972191],[11.494722,48.1962885],[11.4947793,48.1956279],[11.4948342,48.1954035],[11.4949414,48.1951239],[11.4950628,48.1949191],[11.4952673,48.1946477],[11.4953991,48.1944997],[11.4954947,48.1944183],[11.4955652,48.1943652],[11.4956107,48.194331],[11.4956555,48.1942991],[11.495482,48.1946252],[11.495269,48.1948469],[11.4950615,48.1951468],[11.4949912,48.1953175],[11.4949319,48.1955038],[11.4948798,48.1958577],[11.4948385,48.1965738],[11.4947851,48.1975929],[11.4946125,48.1981016],[11.4944756,48.1983841],[11.4943362,48.1986208],[11.4943362,48.1986208],[11.4939869,48.1990471],[11.4933992,48.1996088],[11.4933386,48.1996671],[11.4925506,48.2003831],[11.4922566,48.2007027],[11.4920993,48.2008867],[11.4917178,48.2013328],[11.4915441,48.2015359]]},"properties":null},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.5423601,48.1636446],[11.5424466,48.1635893],[11.5425682,48.1635128],[11.5427932,48.1633744],[11.5427062,48.1634259],[11.5425682,48.1635128],[11.5423601,48.1636446],[11.5423379,48.1636582],[11.5423148,48.1636724],[11.5415857,48.1641196],[11.5414775,48.1640387],[11.5412732,48.1638731],[11.5411406,48.1637783],[11.5411162,48.1637595],[11.5410442,48.163705],[11.5414456,48.1634652],[11.5421477,48.163053],[11.5422762,48.1629814],[11.5424489,48.1628663],[11.5428258,48.1626286],[11.5432074,48.1623846],[11.543937,48.1619379],[11.5445267,48.1615976],[11.5451146,48.1612407],[11.5463329,48.160485],[11.5466829,48.1602253],[11.5469822,48.159976],[11.5473458,48.1596595],[11.5474359,48.1595803],[11.5475783,48.1594466],[11.5476552,48.1593805],[11.547702,48.1593403],[11.5478879,48.1591804],[11.5481647,48.1589423],[11.5484441,48.158702],[11.5492657,48.1580023],[11.5499526,48.1574338],[11.5508255,48.1567114],[11.5515897,48.1561174],[11.5519535,48.1558345],[11.5524985,48.1554109],[11.5525236,48.1553915],[11.5525964,48.1553351],[11.5526388,48.1553018],[11.5524848,48.1552132],[11.552641,48.1550852],[11.5530009,48.1547853],[11.553279,48.1545667],[11.5535232,48.1546104],[11.5531003,48.1549367],[11.5528279,48.155147],[11.5527378,48.1552207],[11.5526388,48.1553018],[11.5524848,48.1552132],[11.552345,48.1553262],[11.5523069,48.155357],[11.5513897,48.1560986],[11.5503499,48.156944],[11.5498384,48.1573599],[11.5494273,48.1576916],[11.5488714,48.1581402],[11.5479681,48.1588723],[11.54746,48.1592627],[11.5473699,48.1593319],[11.547222,48.159447],[11.5471324,48.1595335],[11.547078,48.1595823],[11.54682,48.159814],[11.5467483,48.1599002],[11.5466555,48.1599835],[11.5462468,48.160311],[11.5458067,48.1606145],[11.5456223,48.1607292],[11.5449439,48.1611518],[11.5443167,48.1615236],[11.5438978,48.1617766],[11.5437771,48.1618487],[11.5429662,48.1623217],[11.5422748,48.162738],[11.5421925,48.162788],[11.5419702,48.1629218],[11.5414078,48.1632617],[11.5407442,48.163685],[11.5403742,48.1639109],[11.5400838,48.1640881],[11.5392813,48.164578],[11.5392263,48.1646116],[11.538952,48.1647977],[11.5387121,48.1649887],[11.5387321,48.1652793],[11.5383123,48.1656723],[11.5382203,48.1657585],[11.5381147,48.1658692],[11.5377343,48.1662527],[11.5373037,48.1663093],[11.5367354,48.1668715],[11.5365862,48.1670255],[11.5362735,48.1673258],[11.5361691,48.1674185],[11.5362836,48.1676735],[11.5358136,48.1680405],[11.5355249,48.1682322],[11.5351201,48.1682234],[11.5359809,48.1675755],[11.5360154,48.1675457],[11.5361691,48.1674185],[11.5364834,48.1675076],[11.5362836,48.1676735],[11.5364834,48.1675076],[11.5365695,48.1674284],[11.5368339,48.1671786],[11.5371794,48.1668314],[11.5375764,48.1664088],[11.5377343,48.1662527],[11.5377107,48.165907],[11.5380883,48.1655284],[11.538196,48.1654205],[11.5387121,48.1649887],[11.5391218,48.1649254],[11.5387321,48.1652793]]},"properties":null},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.4846984,48.2127594],[11.4845645,48.2129098],[11.4844335,48.21304],[11.4843955,48.2130742],[11.4837352,48.213656],[11.4836551,48.2137265],[11.4835878,48.2137858],[11.483186,48.2140131],[11.4819413,48.2151278],[11.4817892,48.2152647],[11.481502,48.2155231],[11.4812063,48.2157891],[11.4808691,48.2160808],[11.4806524,48.2163961],[11.4805101,48.216528],[11.4803346,48.2166845],[11.4803117,48.2167054],[11.4802587,48.2167537],[11.4802587,48.2167537],[11.4802017,48.2168057],[11.4801152,48.2167603],[11.4801721,48.2167095],[11.4802017,48.2168057],[11.4801345,48.216867],[11.4801093,48.21689],[11.4800034,48.2169853],[11.479774,48.217192],[11.4791248,48.2177564],[11.4789319,48.217923],[11.4788016,48.218045],[11.4787729,48.2179466],[11.4783149,48.2183431],[11.4770687,48.219476],[11.4768016,48.2196919],[11.4765718,48.219862],[11.4768016,48.2196919],[11.4769149,48.2197101],[11.4767121,48.2198813],[11.4769149,48.2197101],[11.4774485,48.2192431],[11.4788016,48.218045],[11.4787729,48.2179466],[11.4788532,48.2178756],[11.4789548,48.2177852],[11.4790728,48.2176866],[11.4793992,48.2173988],[11.4796799,48.217143],[11.4798771,48.2169705],[11.4800101,48.2168542],[11.4800459,48.2168222],[11.4801152,48.2167603],[11.4801721,48.2167095],[11.4802241,48.2166629],[11.4803525,48.2165476],[11.4806711,48.2162492],[11.4808691,48.2160808],[11.4806524,48.2163961],[11.4807584,48.2162956],[11.48129,48.2158269],[11.4815915,48.2155595],[11.4818781,48.2153053],[11.4819574,48.215235],[11.4826061,48.214654],[11.4832064,48.214121],[11.4834514,48.2139035],[11.4834775,48.2138804],[11.4835878,48.2137858],[11.483464,48.2137623],[11.4835105,48.2137203],[11.4837034,48.2135464],[11.4838054,48.2134544],[11.4840088,48.2132753],[11.4842694,48.213051],[11.4844465,48.2128579],[11.4844986,48.2127932],[11.4845645,48.2127114],[11.4847745,48.2126728],[11.484779,48.2126645],[11.4848105,48.2126071],[11.4849722,48.2123124],[11.4850934,48.2120121],[11.4851119,48.2118962],[11.4851524,48.2117155],[11.4849897,48.211655],[11.4850168,48.2113662],[11.485165,48.2116208],[11.4851524,48.2117155],[11.4850168,48.2113662],[11.4850585,48.2104944],[11.4850737,48.2102659],[11.4850823,48.2101466],[11.4850963,48.2100322],[11.4851192,48.2098411],[11.4851223,48.2098151],[11.4851919,48.2094156],[11.4853903,48.2088001],[11.4855004,48.208599],[11.4855542,48.2084846],[11.4856081,48.2088057],[11.4854145,48.209416],[11.4853989,48.2094717],[11.4853557,48.2096099],[11.4851223,48.2098151],[11.4851919,48.2094156],[11.4853557,48.2096099],[11.4853023,48.2097525],[11.4852578,48.2100514],[11.4852484,48.2102316],[11.4852479,48.2102718],[11.4852351,48.2104211],[11.4852144,48.210662],[11.4852112,48.2107273],[11.4851702,48.2115058],[11.485165,48.2116208],[11.4849897,48.211655],[11.484973,48.2118024],[11.4849105,48.2120643],[11.4848451,48.2122204],[11.4847745,48.2126728],[11.4846984,48.2127594],[11.4845645,48.2127114],[11.4846309,48.2126057],[11.4847481,48.2124148],[11.4848394,48.2122351],[11.4848451,48.2122204]]},"properties":null},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.5287474,48.1721973],[11.5288057,48.1721656],[11.5288577,48.1721394],[11.528953,48.1720886],[11.5295428,48.1717664],[11.5295967,48.1717362],[11.5302926,48.1713006],[11.5304694,48.1714118],[11.5303877,48.1713595],[11.5302926,48.1713006],[11.5304666,48.1711966],[11.5307856,48.1710131],[11.5313449,48.170665],[11.5319506,48.1702828],[11.5325604,48.1698721],[11.5327704,48.169738],[11.532872,48.1696688],[11.5330895,48.1695335],[11.5329674,48.1698552],[11.5328915,48.1699062],[11.5328187,48.1699507],[11.532386,48.1702178],[11.5315141,48.1707524],[11.5306353,48.1713083],[11.5304694,48.1714118],[11.5297554,48.1718438],[11.5295908,48.1719419],[11.5290031,48.1722713],[11.5287884,48.1723797],[11.5285305,48.1725099],[11.528466,48.1725425],[11.5283089,48.1726166],[11.5282264,48.1724683],[11.5283314,48.1724134],[11.5286763,48.1722356],[11.5287196,48.1722116],[11.5287474,48.1721973]]},"properties":null},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[11.5547289,48.1536665],[11.5546797,48.1537065],[11.5541137,48.1541669],[11.5540326,48.1542305],[11.5539251,48.1543149],[11.5539251,48.1543149],[11.5537957,48.1544164],[11.5536379,48.1545318],[11.5535232,48.1546104],[11.553279,48.1545667],[11.5535181,48.1543879],[11.5536244,48.1543167],[11.5537524,48.1542311],[11.5539125,48.1541206],[11.5543895,48.1537473],[11.5544515,48.1536947],[11.5547795,48.1534161],[11.5547289,48.1536665],[11.5550938,48.1533659],[11.5556,48.1529457],[11.5556407,48.1527152],[11.5561041,48.1523191],[11.5561307,48.1522964],[11.5563349,48.1521218],[11.5568737,48.151672],[11.5572041,48.151401],[11.5574862,48.1511607],[11.5575142,48.1511374],[11.5576742,48.1510102],[11.5577344,48.1509541],[11.557806,48.1508945],[11.5578985,48.1510481],[11.5574353,48.1514113],[11.5571804,48.1516116],[11.5570067,48.151748],[11.5563965,48.1522642],[11.556202,48.1524285],[11.5556,48.1529457],[11.5556407,48.1527152],[11.5547795,48.1534161]]},"properties":null}]} ```

Any tips how to get rid of this problem? Since Overpass showed all ways I assume something in the Street_merge process won't work as expected, but thats only a wild guess from a guy how doesn't really know go 🙈

arnesetzer commented 1 year ago

Some visual examples: grafik Position in OSM: https://www.openstreetmap.org/#map=18/48.16826/11.53488

grafik https://www.openstreetmap.org/#map=19/48.19286/11.50200

missinglink commented 1 year ago

Hey @arnesetzer, I haven't looked into it deeply but changing distanceTolerance seems to produce the result you're after?

diff --git a/command/street_merge.go b/command/street_merge.go
index 97770e3..ff9d524 100644
--- a/command/street_merge.go
+++ b/command/street_merge.go
@@ -144,7 +144,7 @@ func joinStreets(streets []*street) []*street {
        }

        // points do not have to be exact matches
-       var distanceTolerance = 0.0005 // roughly 55 meters
+       var distanceTolerance = 0.005

        var reversePath = func(path *geo.Path) {
                for i := path.PointSet.Length()/2 - 1; i >= 0; i-- {
# before
go run pbf.go streets munich-proto.osm.pbf | grep -a 'Dachauer' | wc -l
8

# after
go run pbf.go streets munich-proto.osm.pbf | grep -a 'Dachauer' | wc -l
3

I'm not sure what's going on exactly since the 0.0005 value seems to have served well so far, is there something particularly funky about this geometry?

missinglink commented 1 year ago

Somewhat paradoxically a smaller value of 0.000005 produces 6 results instead of 8.

It's been a long time since I looked at this code but what might be happening here is that the distance threshold is joining two edges and then orphaning a valid segment in the middle 🤔

Just speculating, but it could be that given three segments as such:

                                ┏━━━━━━━━○○───────┐
                                ┃                 │
                                ┃                 │
                                ┃                 │
                                ┃                 │
           ┌──────────○○━━━━━━━━┛                 │
           │                                      │
           │                                      │
           │                                      │
           │                                      │
           │                                      │
○──────────┘                                      └───────○

That the first and third are combined, and the second is orphaned:

                                         ┌─────────┐
                                      ┌──┘         │
                                  ┌───┘            │
                              ┌───┘                │
                          ┌───┘                    │
            ┌─────────────┘                        │
            │                                      │
            │                                      │
            │                                      │
            │                                      │
            │                 ┏━━━━━━━━○           │
 ○──────────┘                 ┃                    └───────○
                              ┃
                              ┃
                              ┃
                     ○━━━━━━━━┛
arnesetzer commented 1 year ago

Hi, thanks for the fast reply and the workaround. I guess you are right with you theory and I think another point is that after pushing a path to another the original start/end-Point was changed so if you have a crossroad where the street splits up it will not get merged due to the changed start/end point.

            ┌──┐
            │C2│
            └┬─┘
             │
             │
            ┌┴─┐
            │C1│
            └──┘

┌──┐        ┌──┐
│A1├────────┤A2│
└──┘        └──┘

            ┌──┐
            │B1│
            └┬─┘
             │
            ┌┴─┐
            │B2│
            └──┘

and after merging A with B the difference between A1 or B2 is to big to get merged with Street C

            ┌──┐
            │C2│
            └┬─┘
             │
             │
            ┌┴─┐
            │C1│
            └──┘

┌──┐        ┌────┐
│A1├────────┤A2B1│
└──┘        └─┬──┘
              │
              │
              │
              │
              │
            ┌─┴┐
            │B2│
            └──┘             

I will see if I can find a better algorithm for that part of the code.

BTW: This tool made better job than valhalla which produced 10 segements for this street 🙈

missinglink commented 1 year ago

I was thinking about this last night before bed and I think the algo is fairly simple, basically:

missinglink commented 1 year ago

I had a play with the algorithm today but couldn't get it to work, I'm giving up for now, might look at it again later.

The code is pushed up on a branch named linemerge-algo. Maybe you can get it over the finish line @arnesetzer?

You can use this link for graphical debugging (make sure to use polyline6): https://valhalla.github.io/demos/polyline/?unescape=true&polyline6=true

missinglink commented 1 year ago

I think I figured it out, try that branch again now and let me know. That street is particularly funky, so it seems impossible to produce less than 6 merged linestrings:

yz~}zAcpr{TrFcGlIaKfb@qg@|KiM|DsEl@s@xBeCfBqB`BiBf@m@xH}IfG{GfEsEh\g`@tO{Q|N{PjC}Chc@qg@h`@od@pLiNn@u@zD{EtBeClC_Djc@ih@bAkAbGeGlHiGjDyCNGrB_AlQaIvQqFfFe@fJoA|DYdFIto@qA`CE`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h@cMbVaJbQs]dq@cAlBsJbP}J~M_Zf_@uEvEuVpVwHzHeDfDeIhIeb@pb@sHhHwQnRyDpE}FrH{@bAmg@xt@_ErFkA`Bu_@`q@qFtJkKbRiJzRsHlNmGrLiCjEy@`B{AnCuBpDuX`e@{Vzd@wT|a@oJ|RoEzIuB}DgBaD|E~IeZnj@{@jBeSzc@cB|Du@fB}@tBmJqAxEmLpSwc@bEgI~Ysk@nEkIva@}u@qsBhgErCyH`AaCbGaO
qjtzzAoao_UlDsGfBmD}O`ZnBmDvCqF}d@j|@`DvEjIxK|DfGb@p@lBnC}X{`@~Zql@Zm@Xk@
qwsyzA_co`UbDaE|J_FLAxACyXfQ`AgAlBwA
sxhyzAg{r`UmDnDmFjDyTzISH{L|E_GfBeSxEqB`@mFz@cB^eHlAo`@xGkHnAeHnA_N~BoCd@qIvAkDn@q@L}@NcHlAcU~DsNhC}Dn@}Dt@gr@vLgMxBuMzBo@hAo@fAaA|Bq@rCYlCHnCRpCEnBQhCk@zBy@lAqDdA
missinglink commented 1 year ago

One of the issues with trying to solve this problem is how to select the starting node, I'm just picking the most north-western point, but depending which one is chosen affects the efficiency of the merging strategy, in some cases selecting a different starting point produces a better result (longer strings).

I don't think it's worth brute forcing all the starting point options, I'm also not sure what's "correct" here, I would prefer having the longest possible paths merged, but that ends up producing a lot of small 'extra' fragments 🤷

arnesetzer commented 1 year ago

Hi, thanks for your effort so far. I agree with you that less than 6 linestrings aren't possible with this street geometry. I tried something by myself by checking whether the Paths intersects, but that produced more than every other solution. (https://github.com/arnesetzer/pbf/commit/a2dc32b00378eb0565ef1e417af729d74fad2a13)

If I saw it correct in the docs for the geo-package the Path component isn't capable of creating a path with branch-offs so it is more or less impossible to get this fully working or do I miss something? If thats the case I would close this issues since this means a total rewrite with a different library.

missinglink commented 1 year ago

If I saw it correct in the docs for the geo-package the Path component isn't capable of creating a path with branch-offs

Yeah this is universally true for GIS formats, they have a concept of a LINESTRING (array of vertices) and MULTILINESTRING (a group of one or more linestrings).

Routing engines aren't bothered by this because they are represented in a non-deterministic graph, this can have multiple edges with the same label.

For the purposes of deduplication of streets for search it might make sense to produce MULTILINESTRINGS with some care to not join disparate streets with the same name in a similar region.

missinglink commented 1 year ago

More info with examples: https://github.com/pelias/pelias/wiki/Interpolation:-conflation