[GraphHopper] Geoposition of an edge

Peter K peathal at yahoo.de
Tue Apr 29 06:32:38 UTC 2014


Hey Phil,

getting the geometry of an edge works like: edge.fetchGeometry(param)
where param is 0,1 or 2 (see javadocs - whether you need the "end
points" too or not).

> How can I get the geo position of the an edge and does anybody know an idea to create a better solution for the geo position of each cell?

You could go the other way around and create a raster of cells every 3
meters (or the equivalent in degrees) so that you know up-front the
position and then via locationIndex.findClosest you find the associated
edge and you can throw away unassigned edges. But handling 'clashes'
could be challenging.

I would probably do it via fetchGeometry and if there are multiple cells
per edge I would assume a linear edge/way as rough approximation.

Regards,
Peter.


> Hello,
>
> I'm using GraphHopper to create a traffic simulation. My car object creates a route between to geo positions (start & end position) and an edge is sampled into cell. I get the edge length and split the edge in cells around 3 meters (floor(edgelength/cellwidth)). My car is set to the cell and moved to next cell based on the current speed. This works fine at the moment.
> So I would like to visualize the car movement and I need the geo position of the cell. My question is: How can I get the geo position of the an edge and does anybody know an idea to create a better solution for the geo position of each cell?
> I would like to create something like:
>
> Geoposition edgegeo = myEdge.getGeoPosition();
> edgegeo + cellposition * cellwidth
>
> Thanks a lot for help
>
> Phil




More information about the GraphHopper mailing list