我在运行Ubuntu 15.10的虚拟机上为Guest OS设置了一个GraphHopper的本地服务器,用于导航/路由.
要初始化服务器,需要指定以下命令(在终端中):,我将从此处java -jar graphhopper-web-0.5.0-with-dep.jar jetty.resourcebase=webapp config=config-example.properties osmreader.osm={osmFileName}.osm.pbf
引用GHServerCommand.
我的问题:我可以将多个OSM文件加载到此服务器吗?
我试图以两种方式尝试这两种方式:
尝试1:
Server started on port 8989
尝试2:
java -jar graphhopper-web-0.5.0-with-dep.jar jetty.resourcebase=webapp config=config-example.properties osmreader.osm={osmFileName1}.osm.pbf,{osmFileName2}.osm.pbf
看到这两次尝试都不成功,我不确定这是否会起作用.有没有办法将多个osm.pbf文件加载到自托管的GraphHopper服务器?
我们正在寻找离线路由和反向地理编码服务.
GraphHopper宣称其Directions API可以自托管:
GraphHopper Directions API自托管/内部部署
Directions API作为云服务提供,您可以按需付费.API也可作为内部部署解决方案(自托管),为您提供最高性能,定制可能性,独立性; 一切都掌握在你手中!
根据这些说明在我的本地实例上安装GraphHopper之后,我能够通过localhost HTTP API成功执行路由查询.
如何使反向地理编码工作?我找不到任何关于此的文档,GitHub上的代码似乎没有任何暗示.
我有一个GraphHopper路由引擎稳定版本0.5的问题
我可以在使用时获得指示vehicle=car
,但这会因自行车和脚而失败.
以下是 GraphHopper地图上大约3分钟步行的示例:
这会在地图上产生结果,这很棒.
我在本地运行时使用了完全相同的坐标,以获取JSON数据,如下所示:
http://localhost:8989/routes?point=-33.916567%2C18.417914&point=-33.917584%2C18.418935&locale=en-US&vehicle=foot
这不会产生任何结果,而是返回以下响应:
{
"message": "Vehicle not supported: foot",
"hints": [{
"message": "Vehicle not supported: foot",
"details": "java.lang.IllegalArgumentException"
}]
}
Run Code Online (Sandbox Code Playgroud)
请注意,将车辆更改为汽车会产生结果!怎么能修好?
为了完整起见,这里是使用vehicle = car的样本请求和响应
{
"paths": [
{
"distance": 151.857,
"time": 18222,
"points_encoded": true,
"weight": 151.857451,
"instructions": [
{
"sign": 0,
"text": "Continue onto Hudson Street",
"time": 3782,
"distance": 31.517,
"interval": [
0,
1
]
},
{
"sign": -2,
"text": "Turn left onto …
Run Code Online (Sandbox Code Playgroud) 我正在使用 graphhopper 库的 SNAPSHOT 版本。
是否可以使用旧版本的快照?我试过:
compile(group: 'com.graphhopper', name: 'graphhopper', version: '0.6-20151126.110118-54') {
exclude group: 'com.google.protobuf', module: 'protobuf-java'
exclude group: 'org.openstreetmap.osmosis', module: 'osmosis-osm-binary'
exclude group: 'org.apache.xmlgraphics', module: 'xmlgraphics-commons'
}
Run Code Online (Sandbox Code Playgroud)
作为存储库我使用:maven { url "https://oss.sonatype.org/content/groups/public/" }
我也尝试过这个存储库:
maven {url "https://oss.sonatype.org/content/repositories/snapshots/"}
Run Code Online (Sandbox Code Playgroud)
但也找不到。
Could not find com.graphhopper:graphhopper:0.6-20151126.110118-54.
Searched in the following locations:
https://jcenter.bintray.com/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.pom
https://jcenter.bintray.com/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.jar
https://oss.sonatype.org/content/groups/public/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.pom
https://oss.sonatype.org/content/groups/public/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.jar
file:/D:/adt-bundle-windows-x86/sdk/extras/android/m2repository/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.pom
file:/D:/adt-bundle-windows-x86/sdk/extras/android/m2repository/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.jar
file:/D:/adt-bundle-windows-x86/sdk/extras/google/m2repository/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.pom
file:/D:/adt-bundle-windows-x86/sdk/extras/google/m2repository/com/graphhopper/graphhopper/0.6-20151126.110118-54/graphhopper-0.6-20151126.110118-54.jar
Run Code Online (Sandbox Code Playgroud)
我也尝试过使用 gradle 缓存的本地路径(在删除最新的快照目录并保留我想使用的版本之后),但没有成功。如果不可能,有什么办法可以停止下载新的 SNAPSNOT 版本吗?
感谢帮助。
我正在尝试修改CarFlagEncoder.java,以便GraphHopper将使用两条道路,默认情况下它不会:
http://www.openstreetmap.org/way/181263007
http://www.openstreetmap.org/way/37720333
我的意思是说,允许进入这条路就像restrictedValues.add("private")
从public CarFlagEncoder( int speedBits, double speedFactor, int maxTurnCosts )
方法中删除一样简单?
public CarFlagEncoder( int speedBits, double speedFactor, int maxTurnCosts )
{
super(speedBits, speedFactor, maxTurnCosts);
restrictions.addAll(Arrays.asList("motorcar", "motor_vehicle", "vehicle", "access"));
restrictedValues.add("private");
restrictedValues.add("agricultural");
restrictedValues.add("forestry");
restrictedValues.add("no");
restrictedValues.add("restricted");
restrictedValues.add("delivery");
restrictedValues.add("military");
Run Code Online (Sandbox Code Playgroud)
它在那里或在acceptWay
我需要修改的方法中:
@Override
public long acceptWay( OSMWay way )
{
String highwayValue = way.getTag("highway");
if (highwayValue == null)
{
if (way.hasTag("route", ferries))
{
String motorcarTag = way.getTag("motorcar");
if (motorcarTag == null)
motorcarTag = way.getTag("motor_vehicle");
if (motorcarTag == …
Run Code Online (Sandbox Code Playgroud) 我一直在用 osmdroid 和 osm 奖励包(惊人的库!)搞砸了一段时间,并且一直在思考离线路由和转弯导航的想法,现在,我还没有尝试任何东西,但有些东西听起来很不错有希望将graphhopper加入混合:
官方维基指南如下:
现在,这是为 MapsForge 设计的,我还没有机会查看生成的 .ghz 文件,其中包含地图的路由数据,但我的问题是,是否可以使用此路由数据构建一个 PathOverlay 对象进入 OSM Bonus Pack 来实际绘制某种路线?
我想知道是否有人已经尝试过这种类型的东西并且对此有话要说,任何帮助表示赞赏。
我们正在考虑在我们需要做路线规划的项目中使用它.我们遇到的第一个问题是我们有非常dyanimc变量代表我们的重量值; 这意味着我们不能使用收缩层次算法因为每当这些变量中的一个发生变化时我们应该重新创建"收缩"图,所以我们考虑配置graphhopper以便不使用CH算法
在这种情况下,是否可以修改graphhopper代码以支持此动态边缘权重值?例如,假设我们有节点A和节点B以及边缘A-B; 让我们假设这个边有一个值3在我们的场景中,可以有一个事件可以将边A-B的值从3修改为6或从3修改为2我们可以修改代码以支持此功能吗?这是否依赖于DataAccess实现?
谢谢Angelo
我已经Graphhopper
使用$ git clone
命令并使用此处提供的亚洲地图在Ubuntu Server中进行了安装。
我使用以下命令启动了服务器:
$ ./graphhopper.sh web asia_india.pbf
Run Code Online (Sandbox Code Playgroud)
然后在发送以下请求时出现错误:
http://serveraddresss:8989/route?calc_points=false&point=9.983242,76.390418&point=9.990618,76.421088
Run Code Online (Sandbox Code Playgroud)
我从服务器收到的答案是:
{“ info”:{“ errors”:[{“ message”:“找不到点1:9.9906,76.421”,“详细信息”:“ java.lang.IllegalArgumentException”}]}}}
显然,在功能getPaths()
的核心/ src目录/主/ JAVA / COM / graphhopper / GraphHopper.java,功能locationIndex.findClosest(point.lat, point.lon, edgeFilter);
没有得到任何附近的道路。
但是,如果我在Graphhopper网站上尝试相同的点,它将得到它的最近点和到它的距离。(您可以在此处看到此内容)。
我想知道为什么我的Graphhopper服务器设置会提供与graphhopper.com不同的结果。
是否需要更改任何配置才能进行实时Graphhopper设置?
还可以有人告诉我如何在启动时单独重建jar文件,
$ ./graphhopper.sh web asia_india.pbf
以便可以打印一些图像并尝试调试或改进系统吗?
该功能如何locationIndex.findClosest(point.lat, point.lon, edgeFilter);
工作?我实际上不是来自Java背景。
我需要开发一个内部应用程序,其中源的用户和最多8个目的地,在地图上绘制最佳路线并以km为单位显示距离.因此,基于该里程,系统将计算其成本.我使用Google Maps API实现了此功能,但应用程序仅限于公司,因此我们必须获得许可证.我想知道GraphHopper是否可以在内部免费使用公司.