Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation not correct at graphhopper/docs/core/location-index.md #1793

Closed
AzureIP opened this issue Nov 13, 2019 · 3 comments
Closed

Documentation not correct at graphhopper/docs/core/location-index.md #1793

AzureIP opened this issue Nov 13, 2019 · 3 comments

Comments

@AzureIP
Copy link

AzureIP commented Nov 13, 2019

Hi,
In your Documentation at the location index code example the code is not totally correct:

GraphHopper hopper = new GraphHopper();
hopper.set...
hopper.importOrLoad();

LocationIndex index = hopper.getLocationIndex();

//  now you can fetch the closest edge via:
QueryResult qr = findClosest(lat, lon, EdgeFilter.ALL_EDGES );
EdgeIteratorState edge = qr.getClosestEdge();

Yout have to call the function findClosest on the index object you have created before.
So it has to be QueryResult qr = index.findClosest(lat, lon, EdgeFilter.ALL_EDGES );.
I would advise to change this.

Thanks!

@karussell
Copy link
Member

karussell commented Nov 13, 2019

Thanks! Yes, we'll probably create some code in the repository (to keep those examples up to date) that we then reference in our documentation. Related #774

@AzureIP
Copy link
Author

AzureIP commented Nov 13, 2019

Hello karussell,
Thanks for the reply. I have a furthure question to that code. What do I get exactly?
Screenshot (15)

I asked for the closesd way/road to the point in the lake. (Simply the first point in my dataset)

QueryResult qr = index.findClosest(location.lat, location.longd, EdgeFilter.ALL_EDGES );
EdgeIteratorState edge = qr.getClosestEdge();
PointList ghPoint3DS = edge.fetchWayGeometry(0);
for (int i = 0; i < ghPoint3DS.size(); i++) {
    System.out.println("got point " + i + " along: " + ghPoint3DS.getLat(i) + ", " + ghPoint3DS.getLon(i));
}

And I get some Points close to it in some kind of a line. But not points of the closest road where the navigation would begin. What are the three points, and how do I get points from the closest road?

@karussell
Copy link
Member

For questions please use our public forum (create a new topic): https://discuss.graphhopper.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants