找到你要的答案

Q:Embed graphhopper into project

Q:graphhopper嵌入到项目

I would like to embed graphhopper into my java application (J2EE) in order to calculate route distances between many points on the map. Points are given by their longitudes and latitudes. I don't need to render the map.

Can you give step by step details how to do that?

This link describes lines of code to be added. But it doesn't tell how to import graphhopper classes into my project.

I downloaded .pbf for my region and graphhopper project itself and getting stuck how to use it.

我想把graphhopper进入我的java应用(J2EE)为了计算在地图上多点之间的路线距离。点的经度和纬度了。我不需要渲染地图。

你能给一步一步的细节如何做到这一点?

此链接描述要添加的代码行。但它并不告诉如何导入graphhopper类为我的项目。

我下载了,我graphhopper PBF区域和项目本身陷入如何使用它。

answer1: 回答1:

But it doesn't tell how to import graphhopper classes into my project.

Take a look into the quickstart. You need to include the graphhopper dependencies via maven or gradle:

<dependency>
  <groupId>com.graphhopper</groupId>
  <artifactId>graphhopper</artifactId>
  <version>0.4.1</version>
</dependency>

If you need the details about the imports for graphhopper just use an IDE to automatically import those (e.g. NetBeans, IntelliJ, Eclipse)

但它并不告诉如何导入graphhopper类为我的项目。

看看快速入门。你需要包括graphhopper依赖通过Maven或摇篮:

<dependency>
  <groupId>com.graphhopper</groupId>
  <artifactId>graphhopper</artifactId>
  <version>0.4.1</version>
</dependency>

如果你需要进口的细节graphhopper只是使用IDE自动导入(如NetBeans,IntelliJ,Eclipse)

answer2: 回答2:

Assuming you cloned the graphhopper project you can build the jar

mvn clean install

which will create a jar in core/target with the current snapshot version of graphhopper (or checkout one of the releases to get a specific version). Just add this jar file to your project like you would any other third party jar.

Then to "import" your pbf file into graphhopper speak you would run from the graphhopper project directory...

./graphhopper.sh import <pbf_file>

which will create a directory in the same location and name as your pbf file but with "-gh" tacked onto the end of the filename. This is the directory that you will point your code to for graphhopper to read. I'm guessing this should be explained in the link you provided above.

假设你将graphhopper项目你可以造的罐子

MVN清洁安装

这将创建一个JAR核心/目标与graphhopper当前快照版本(或检验的一个版本获得特定版本)。只需将这个JAR文件添加到您的项目中,就像任何其他第三方JAR一样。

然后“进口”你说你graphhopper PBF文件将从graphhopper项目目录…

。/ graphhopper.sh进口& lt;pbf_file & gt;

这将创建一个目录在同一位置和名称作为你的PBF文件但“GH”加入到最后的文件名。这是目录,你会点你的代码为graphhopper读。我猜这应该解释你提供的链接上面。

java  openstreetmap  graphhopper