问题标签 [pgrouting]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
database - pgrouting 和 osm2pgrouting 导入工具
前面的命令是一行。并且在使用此选项时,ubuntu 会给出“选项'--conf' 不能多次指定”错误。
algorithm - 精确位置的 pg_routing 性能
pg_routing 从起点和终点找到最短路径,它们是路径(节点)上的确切顶点,但是当我们想要找到不在路径上的位置的最短路径时(如 POI、确切地址、 ...)。一般的解决方案是搜索最近的节点,然后计算最短路径,但如果例如道路长度较大,或者最近的节点在另一条不相交的道路上,结果可能与实际相去甚远搜索位置最近的道路。所以,我考虑了这个问题的 2 个解决方案,但我真的不知道如果网络长大,pg_routing 算法的效率如何:1-在每 X 米处分割道路,这将大大增加节点的数量,顺便说一句拓扑,然后计算这些新节点上的最短路径,
postgresql - PostgreSQL、Postgis 和 Pgrouting 兼容版本
我正在尝试在 Ubuntu (VPS) 中使用 PostgreSql 9.3、Postgis 2.1.3 和 Pgrouting 2.0.0 版本。我已经安装了 PostgreSql 9.3,但是当我 CREATE EXTENSION postgis SCHEMA public VERSION "2.0.0";
在 PgAdmin3 中运行时出现错误:无法统计文件“/usr/share/postgresql/9.3/extension/postgis--2.1.3.sql”:没有这样的文件或目录和同样的错误使用 Pgrouting 2.0.0。这些版本是否兼容在该系统中运行?,在 localhost 中工作正常。
postgresql - Postgis ST_Split 不按所有点分割道路
我有一张包含芝加哥街道网络的表格,还有一张在芝加哥犯下罪行的表格。我正在尝试通过将它们分配给距离最短道路距离的集群中心来为犯罪创建 k-means 集群。
首先,我将所有犯罪插值到最近的道路上。到目前为止,一切都很好。现在我要做的是将每条道路上的所有犯罪点分开,这样我就可以使用 pgrouting 和从一个犯罪地点到另一个犯罪地点的路线来创建网络拓扑。
问题是,ST_Split 函数似乎没有分割大部分道路,我不知道为什么。鉴于我有一百万个犯罪点,道路应该被分成大量的路段,但我只得到比原始街道网络表中的多一千行。这是我正在使用的命令:
我使用的是 Postgis 2.2.2 版,所以我被多点分割的事实不是问题..
任何帮助,将不胜感激!
postgresql - 如何使用 pgRouting 计算距离和时间
我正在尝试使用 pgr_dijkstra 从 pgRouting 中获取路由的总时间和距离,但我基本上不知道如何实现它。到目前为止,我设法弄清楚 pgr_dijkstra 的回报是成本单位,我总结了它们。我假设计算距离和时间实际上是在路线中的每一段完成的。有人有如何做到这一点的例子吗?
上面的陈述会给我所有单位成本的总和......
postgresql - pgrouting all_pairs -> 搜索直到在非常大的图上设置阈值距离?
是否有一种有效的方式来使用 pg_routing 进行全对最短路径搜索,但只能达到一定距离?我的用例是大型道路网络,但我只想搜索从一个节点到另一个节点的最短路径,其中路径不超过 ~2000m。
目前我没有看到在所有对或非所有对最短路径函数上设置阈值的选项。
想到的唯一方法是沿着这些思路:
迭代所有节点;
以节点为中心点,基于阈值创建空间缓冲区;
将网络剪辑到缓冲区;
然后计算最短路径;
丢弃网络路径大于阈值的目的地;
将结果写入汇总结果的表中;
对每个节点重复。
这对我的目的来说不是很有效。是否有另一种使用 pgrouting 的方法来做到这一点?(不必在数据库之外复制图形并在其他地方进行分析?)
postgresql - 如何使用 OSM2pgrouting 的 mapconfig.xml
我想了解如何利用 osm2pgrouting 的 mapconfig.xml 过滤掉某些类型的道路(例如,有私人通道的道路或高速公路和高速公路连接)。宁愿了解如何使用它们,也不愿给我答案。非常非常感谢你 :)
c++ - 没有 libpq++ 和 SQLAPI++ 的 C++ 和 Postgresql
如何在不使用 libpq++ 或 SQLAPI++ 的情况下在 C++ 和 Postgresql 之间建立接口,因为我尝试安装这两个库但我无法安装(没有 Windows 教程)。我知道 Postgis 和 Pgrouting 使用 C++ .. 也许他们使用另一个库来与 Postgresql 交互......
谢谢 :D
postgresql - 如何获得正确的 pgRouting 结果
我正在尝试基于 OSM 数据运行 pgRouting,但在正确运行时遇到了一些问题。
我在 Ubuntu 机器上安装了 PostgreSQL 9.5。PostGIS_full_version 回来了
- "POSTGIS="2.2.2 r14797"
- GEOS="3.4.2-CAPI-1.8.2 r3921"
- PROJ="Rel. 4.8.0,2012 年 3 月 6 日"
- GDAL="GDAL 1.11.2,发布于 2015/02/10"
- LIBXML="2.9.1"
- LIBJSON="0.11.99"
- 拓扑栅格",
并且 pgRouting 安装在 2.2.3 版本中。
我在 2.1 版中使用 osm2pgrouting 从 Geofabrik 导入 osm 文件并构建拓扑。
导入后,表格中的“长度”列包含非常小的值,而应该具有以公里为单位的距离信息。与“length_m”列的比较表明,以米为单位的距离或以公里为单位的距离是错误的。基于这个讨论,我可以解决距离问题。
但是,“成本”列似乎是“长度”列的副本,并且在上面链接的讨论中,成本列没有重新计算,我不确定是否也应该这样做。
因此,我添加了另一列('to_cost'),其中包含重新计算的距离。以下 SQL 查询利用了这一点:
返回的距离为 232.388203319894 公里,此行程所需的时间(以分钟为单位)为 275.537860166885 分钟。
我试图在OpenStreetMap计算相同的路线,在这里我得到了一条稍长但更快的路线返回。因此,我想知道我是否在这里做正确的事情。
此外,当我使用 'cost' 列和来自 osm2pgrouting 的导入数据而不是 'to_cost' 列时,无论我说 reverse_cost 是真还是假,我都会得到 123.397950457207 公里。
使用“to_cost”列并将 reverse_cost 设置为 true,然后我得到的距离只有 143.048209059395 公里,时间值为 169.415916099922 分钟。
postgresql - 在 PostGIS 中查找并返回路径/路线经过的多边形
嗨,我面临的挑战是找到一条路径作为多线串返回、交叉或穿过的多边形。因此,如果我必须从 A 到 B,那么我必须计算并返回我访问的所有多边形,包括包含的多边形 A 和 B。这在 PostGIS 中如何实现?
所以我有一张看起来像这样的地图和路线:MAP with approx route
并且可以在这里看到我返回的多行字符串
{ "type": "MultiLineString", "coordinates": [ [ [[9.3555111, 57.1437626], [9.354822, 57.1438372], [9.3535543, 57.1440033] ], [ [9.3561095, 57.1437043], [9.35,37526], [9.35,37526.] 9.3572876, 57.1435895], [9.3561095, 57.1437043] ], [ [9.3574905, 57.1435697], [9.3572876, 57.1435895] ], [ [9.3578022, 57.1435618], [9.3574905, 57.1435697] ], [ [9.3579576, 57.1435655], [9.3578022, 57.1435618], [[9.3571448, 57.1462326], [9.3571254, 57.1461296], [9.3571139, 57.1459493], [9.3571267, 57.1457911], [9.3571777, 57.1455926], [9.3572617, 57.1453846], [9.3576578, 57.1445901], [9.3578012, 57.1442991], [9.3579052, 57.1439939], [9.3579244, 57.1439216], [9.3579576, 57.1435655] ], [ [9.3572195, 57.1462287], [9.3571448, 57.1462326] ], [ [9.3572195, 57.1462287], [9.3572649, 57.146383], [9.357327, 57.1465307], [9.3574453, 57.1467449], [9.3575921, 57.1469549], [9.3577695, 57.1471422], [9.3579757, 57.1473145], [9.3584842, 57.1476965], [9.3593117, 57.1483147], [[9.3593117, 57.1483147],[9.3594894, 57.1482729], [9.3597109, 57.1482499], [9.3599176, 57.148252], [9.3600273, 57.148263] ], [ [9.3600273, 57.148263], [9.3602192, 57.1482932], [9.3608886, 57.1484771] ], [ [9.3608886, 57.1484771 ], [9.3614141, 57.1485938], [9.3619974, 57.1486991], [9.3626358, 57.1487903], [9.3631325, 57.1488405], [9.3636579, 57.1488672], [9.3647925, 57.1488727], [9.366019, 57.1488006], [9.366409, 57.1487376] ] , [ [9.366409, 57.1487376], [9.3669798, 57.1486454], [9.3679406, 57.148418], [9.3681876, 57.1483527] ],[ [9.3681876, 57.1483527], [9.3683101, 57.1483157] ], [ [9.3683101, 57.1483157], [9.3724174, 57.1470762], [9.3774741, 57.1455547] ], [ [9.3774741, 57.1455547], [9.3811383, 57.1444522], [9.3858889, 57.1430227], [9.3893335, 57.1419691], [9.3926962, 57.1409709], [9.3942157, 57.1405259] ], [ [9.3942157, 57.1405259], [9.3943623, 57.1404829], [9.394568, 57.1404381] ], [ [9.394568, 57.1404381], [ 9.3958137, 57.1401667], [9.3975206, 57.1398451], [9.3989005, 57.1396787], [9.4002496, 57.1395567],[9.4014251, 57.1395012], [9.4056873, 57.139296], [9.4100677, 57.1390735] ], [ [9.4100677, 57.1390735], [9.4107366, 57.1390742], [9.4121471, 57.1390797], [9.4130772, 57.1391241], [9.4139562, 57.1391796], [9.4151828, 57.1392905], [9.4177483, 57.1396621], [9.4222353, 57.1403331], [9.4230122, 57.1404551], [9.4239014, 57.1405716], [9.4268349, 57.14086], [9.4287227, 57.1410362] ], [ [9.4287227, 57.1410362], [9.4295318, 57.1411117], [[9.4295318, 57.1411117], [9.4312913, 57.1412759], [9.4334173, 57.1414589],[9.4357477, 57.1417695], [9.4410116, 57.1424737], [9.444589, 57.1429507], [9.4468172, 57.1432335], [9.4487797, 57.1435052], [9.4499035, 57.1436858], [9.4511325, 57.1440427], [9.4521711, 57.1444277], [9.4532933 , 57.1449746], [9.4536954, 57.1452012] ], [ [9.4536954, 57.1452012], [9.4539329, 57.1450673], [9.4541521, 57.1450064] ], [ [9.4541521, 57.1450064], [9.4571546, 57.1432029] ], [ [9.4571546, 57.1432029 ]、[9.4575749、57.1429363]、[[9.4632247、57.1440417]、[9.4575749、57.1429363]]、[ [9.4677832, 57.1449625], [9.4632247, 57.1440417] ], [ [9.4702609, 57.1449583], [9.468828, 57.1449876], [9.4682462, 57.1449956], [9.4677832, 57.1449625] ], [ [9.4730542, 57.1449118], [9.4702609, 57.1449583] ], [ [9.4736102, 57.1448992], [9.4730542, 57.1449118] ], [ [9.476478, 57.1448101], [9.4758299, 57.1448487], [9.4736102, 57.1448992] ], [ [9.4776624, 57.1447481], [9.4770398, 57.1447683] , [9.476478, 57.1448101], [ [9.4797556, 57.1450294], [9.4784706, 57.1449687],[9.4781911, 57.1449135], [9.4779318, 57.1448253], [9.4776624, 57.1447481] ], [ [9.482506, 57.1453423], [9.4806997, 57.1451109], [9.4797556, 57.1450294] ], [ [9.4856798, 57.1453847], [9.4833677, 57.1453751 ], [9.482506, 57.1453423] ], [ [9.4878125, 57.145319], [9.4863807, 57.1453842], [9.4856798, 57.1453847] ], [ [9.4886688, 57.1452634], [9.4878125, 57.145319] ], [ [9.4896027, 57.1452074], [9.4886688, 57.1452634], [[9.4900872, 57.1451784], [9.4896027, 57.1452074]],[ [9.4915526, 57.1450695], [9.4900872, 57.1451784] ], [ [9.5033371, 57.144857], [9.4925869, 57.1449936], [9.4915526, 57.1450695] ], [ [9.5062344, 57.1466448], [9.5056962, 57.1464416], [9.5051967, 57.14621], [9.5033371, 57.144857] ], [ [9.5153133, 57.1490422], [9.5152178, 57.1489798], [9.5150239, 57.1488945], [9.5143783, 57.1486929], [9.5120804, 57.1480541], [9.5080348, 57.1470259], [9.5070276, 57.1468355], [9.5062344, 57.1466448], [[9.516164, 57.151073], [9.5161224, 57.1510048],[9.516166, 57.1507837], [9.5161656, 57.1506361], [9.5161163, 57.1504358], [9.5156098, 57.1493643], [9.515405, 57.1491178], [9.5153133, 57.1490422] ], [ [9.517273, 57.1512057], [9.5164759, 57.1511709], [9.5162961, 57.1511398], [9.516164, 57.151073] ], [ [9.5254761, 57.1521458], [9.5251101, 57.1520388], [9.5247146, 57.1519563], [9.5235082, 57.1517346], [9.5230687, 57.1516258], [9.5221932, 57.1512634], [9.5219455, 57.1511788], [9.5216993, 57.1511442], [9.5214123, 57.1511386], [9.5189081, 57.1512418], [9.5182031, 57.1512418], [9.517273, 57.1512057] ], [ [9.526051, 57.152711], [9.5259224, 57.1526441], [9.5258034, 57.1525262], [9.525622, 57.1522691], [9.5254761, 57.1521458] ], [ [9.5302396, 57.1529888], [ 9.5265538, 57.1528129], [9.5263203, 57.1527829], [9.526051, 57.152711] ], [ [9.5336269, 57.1533783], [9.5332398, 57.1532048], [9.5330259, 57.1531359], [9.5328073, 57.1531114], [9.5302396, 57.1529888] ], [ [9.5387981, 57.1554757], [9.5384128, 57.155428], [9.5380023, 57.1553493], [9.5376739, 57.1552415], [9.5373527, 57.1550966], [9.537085, 57.1549439], [9.5368319, 57.1548143], [9.5336269, 57.1533783] ], [ [9.5414655, 57.1558512], [9.5413173, 57.1557635], [9.5411112, 57.1556573], [9.540898, 57.1556003], [ 9.5405117, 57.155565], [9.5387981, 57.1554757] ], [ [9.5416406, 57.1571697], [9.5414383, 57.1559276], [9.5414655, 57.1558512] ], [ [9.541798, 57.1581042], [9.5416406, 57.1571697] ], [ [9.5421883, 57.1604317], [9.541798, 57.1581042], [[9.5422647, 57.160858], [9.5421883, 57.1604317]],[ [9.5429259, 57.1646325], [9.5422647, 57.160858] ], [ [9.5577988, 57.1658202], [9.5482666, 57.1650468], [9.5431324, 57.1646357], [9.5429259, 57.1646325] ], [ [9.5654501, 57.1664078], [9.5642455, 57.1663137], [9.5577988, 57.1658202] ], [ [9.567757, 57.1665879], [9.5654501, 57.1664078] ], [ [9.5709973, 57.1668223], [9.5708411, 57.1668176], [9.567757, 57.1665879] ], [ [9.5709973, 57.1668223] , [9.5712722, 57.1668408], [9.575661, 57.1671735], [9.5757638, 57.1671973]],[ [9.5877421, 57.1689964], [9.5857565, 57.1685859], [9.5817132, 57.1676194], [9.5813375, 57.1675939], [9.5788932, 57.1674225], [9.5766478, 57.1672516], [9.5757638, 57.1671973] ], [ [9.586522, 57.1701951] , [9.5877421, 57.1689964] ], [ [9.5933471, 57.1712614], [9.5929056, 57.171103], [9.5925623, 57.1710033], [9.5921332, 57.1710598], [9.5917225, 57.1711296], [9.5911586, 57.1711097], [9.5906988, 57.1710631] , [9.586522, 57.1701951], [ [9.59778, 57.1755274], [9.5974602, 57.1752393], [9.5973578, 57.1750332],[9.5970679, 57.174671], [9.5969331, 57.1746112], [9.5966756, 57.1745481], [9.5962342, 57.1743653], [9.5960565, 57.1742523], [9.5956764, 57.1741393], [9.5953331, 57.1739233], [9.5951553, 57.1737505], [9.5951423 , 57.173544], [9.5950793, 57.1733709], [9.5949001, 57.1732655], [9.5950039, 57.1731825], [9.5949776, 57.1730893], [9.5948795, 57.1729563], [9.5946833, 57.1728732], [9.5940625, 57.1728038], [9.5936719, 57.1727337 ], [9.5934466, 57.1726295], [9.5933211, 57.1725441], [9.5931893, 57.1724999], [9.5929699, 57.1724455], [9.5929249, 57.1723807],[9.5929664, 57.1722459], [9.5929023, 57.172217], [9.5927704, 57.1721109], [9.5926788, 57.1719604], [9.5929145, 57.1717318], [9.5929827, 57.1715872], [9.5930979, 57.1714821], [9.5931311, 57.1714206], [9.5932017 , 57.1713511], [9.5933471, 57.1712614] ], [ [9.6047945, 57.1747181], [9.6045993, 57.1746559], [9.6044316, 57.1746341], [9.6037672, 57.1746425], [9.6035456, 57.1746646], [9.6024995, 57.1749798], [9.6021384 , 57.175039], [9.6003157, 57.1752783], [9.6000176, 57.175294], [9.5990388, 57.1754059], [9.59873, 57.1754157], [9.59778, 57.1755274] ], [ [9.6127373, 57.1772197], [9.6098243, 57.1763209], [9.6062355, 57.1751704], [9.6059362, 57.1750485], [9.6047945, 57.1747181] ], [ [9.6136709, 57.1775394], [9.6127373, 57.1772197] ], [ [9.6137431, 57.1775623], [9.6136709, 57.1775394] ], [ [9.6226472, 57.1800812], [9.6191266, 57.1792676], [9.6137431, 57.1775623] ], [ [9.6247259, 57.1805615], [9.6226472, 57.1800812] ], [ [9.626882, 57.1810791], [9.6247259, 57.1805615] ], [ [9.6287287, 57.1818221],[9.6287134, 57.1817708], [9.6286223, 57.1816803], [9.6280713, 57.1814399], [9.626882, 57.1810791] ], [ [9.6287287, 57.1818221], [9.6288488, 57.1818093], [9.6289428, 57.1818202], [9.6290759, 57.1818612], [9.6293552, 57.1819947], [9.629604, 57.1821842], [9.6296353, 57.1822356], [9.6296214, 57.1823002] ], [ [9.6303236, 57.1825125], [9.6296214, 57.1823002] ], [ [9.6307599, 57.1826438], [9.6303236, 57.1825125 ] ], [ [9.6324711, 57.183159], [9.6307599, 57.1826438] ], [ [9.6354295, 57.1840354],[9.6350074, 57.1839225], [9.6324711, 57.183159] ], [ [9.6362413, 57.184182], [9.6358706, 57.1841322], [9.6354295, 57.1840354] ], [ [9.6367365, 57.1842275], [9.6364984, 57.1842114], [9.6362413, 57.184182 ] ], [ [9.6378766, 57.1842574], [9.6367365, 57.1842275] ], [ [9.6390149, 57.1842935], [9.6378766, 57.1842574] ], [ [9.6451831, 57.1850131], [9.6444469, 57.1847934], [9.643728, 57.1846266], [9.6428365, 57.1844879], [9.6419594, 57.1844018], [9.6409752, 57.1843545], [9.6390149, 57.1842935] ], [ [9.6465635, 57.1855788], [9.6459567, 57.1853061], [9.6451831, 57.1850131] ], [ [9.6522672, 57.1882655], [9.6465635, 57.1855788] ], [ [9.6544744, 57.1893016], [9.6540537, 57.1891092] , [9.6522672, 57.1882655] ], [ [9.6562787, 57.1900128], [9.6558348, 57.1898745], [9.6552766, 57.189656], [9.6544744, 57.1893016] ], [ [9.6567186, 57.1901368], [9.6562787, 57.1900128] ], [ [ 9.6575416, 57.1903173], [9.6571738, 57.1902454], [9.6567186, 57.1901368] ], [ [9.6627065, 57.190584], [9.660466, 57.1905533], [9.6596238, 57.1905408], [9.6587971, 57.1904843], [9.6582137, 57.1904215], [9.6575416, 57.1903173] ], [ [9.6642627, 57.190681], [9.663499, 57.1906151], [ 9.6627065, 57.190584] ], [ [9.6683386, 57.1914239], [9.6652064, 57.1908326], [9.6642627, 57.190681] ], [ [9.6692696, 57.1916115], [9.6683386, 57.1914239] ], [ [9.6722869, 57.1919033], [9.6717856, 57.1918944], [9.671251, 57.1918641], [9.6707397, 57.1918245], [9.6701725, 57.1917563], [9.6697747, 57.1916999],[9.6692696, 57.1916115] ], [ [9.6721281, 57.1924274], [9.6722869, 57.1919033] ], [ [9.6719929, 57.1929592], [9.6721281, 57.1924274] ], [ [9.6719054, 57.1933035], [9.6719929, 57.1929592] ], [ [9.6718815, 57.1934584], [9.6718858, 57.1933804], [9.6719054, 57.1933035] ], [ [9.6719676, 57.1941722], [9.6718748, 57.1935809], [9.6718815, 57.1934584] ], [ [9.6720584, 57.1948215], [9.6719676, 57.1941722 ] ], [ [9.6720879, 57.1950329], [9.6720584, 57.1948215] ],[ [9.672901, 57.1950078], [9.6720879, 57.1950329] ], [ [9.672901, 57.1950078], [9.6729386, 57.195217] ], [ [9.6729386, 57.195217], [9.6729586, 57.1953285] ], [ [9.6729601, 57.195406], [ 9.6729586, 57.1953285] ], [ [9.6730101, 57.1961026], [9.6729816, 57.1955673], [9.6729601, 57.195406] ], [ [9.6731242, 57.1960885], [9.6730101, 57.1961026] ], [ [9.6732539, 57.1973861], [9.6732154, 57.1973583]、[9.6731685、57.1962711]、[9.6731242、57.1960885]]、[[9.6738644, 57.1973537], [9.6732923, 57.1974023], [9.6732539, 57.1973861] ] }
在我的地图表中,我只有几何数据作为多边形。所以我认为应该可以检查一组 og 坐标是否包含在 geom->polygon 中,但是如何?似乎无法弄清楚如何使用 ST 函数以及究竟是哪一个。