[GraphHopper] Mapping node id to lat/lon

Thi Nguyen thi at uber.com
Tue Dec 9 23:04:57 UTC 2014


oh, in that case you probably need a mapping between internal node ids and
osm node ids, which could be created when the osm file is read.

On Tue, Dec 9, 2014 at 2:47 PM, Emden R. Gansner <erg at research.att.com>
wrote:

> On 12/8/14 6:14 PM, Thi Nguyen wrote:
>
>> You can use getLat() and getLon() in NodeAccess, if I understand your
>> question correctly.
>>
> Thanks. I wasn't clear enough. A node in the OSM file possesses an id
> field. Is there some way to use that number to
> get the corresponding latitude and longitude or, equivalently, to get the
> internal id? Or perhaps I am not accessing the
> right class implementing NodeAccess. I tried using
>
>      int nodeId = .... // id from OSM file
>      GraphHopper hopper = ....  // graph has been loaded
>      GraphStorage graph = hopper.getGraph();
>      double lat = graph.getNodeAccess().getLatitude(nodeId);   // array
> out of bounds error
>
> Again thanks.
>
>
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20141209/ce31aec3/attachment.html>


More information about the GraphHopper mailing list