[GraphHopper] How to find all the roads leading around a point

Gp P gp at gpism.com
Mon Mar 9 08:08:54 UTC 2015


Hi Peter ,

>>you will need to use a graph exploration algorithm like Dijkstra with a
shortest weighting and specify the weight limit to the distance you want
How I will accomplish this for edgeiterator ?


I think its possible to query using GHQuery but needs the exact points ,
which doest comply to my problem statement...how do I find all roads from a
point on  the road with x meters away and exact point on each of edges
/connecting road after x meters

GHRequest req = new GHRequest(latFrom, lonFrom, latTo, lonTo).
    setWeighting("fastest").
    setVehicle("car");GHResponse rsp = hopper.route(req);


My Code

EdgeIteratorState edge = qr.getClosestEdge();
        ShortestWeighting shortestWeighting=   new ShortestWeighting() ;
        shortestWeighting.getMinWeight(distance)
        Dijkstra dijkstra=    new
Dijkstra(hopper.getGraph(),encodingManager.getSingle(),new
ShortestWeighting());
        EdgeIterator edgeIterator= edx.setBaseNode(edge.getBaseNode());
     //   edgeIterator.

        edgeIterator.setDistance(distance);
        while (edgeIterator.next()){

            int edgeNo=    edgeIterator.getAdjNode();
        Path path= dijkstra.calcPath(edge.getBaseNode(), edgeNo)  ;
            data.add(edgeNo)  ;

            _logger.info(" Adjacent Edge : "+path.getDistance());

        }
I hope its possible , I have tried many approaches they solve only one part
of problem

Regards ,
G

On Fri, Mar 6, 2015 at 12:54 PM, Peter <graphhopper at gmx.de> wrote:

>  On 06.03.2015 07:13, Gp P wrote:
>
> As you can see above , i trying get all edges with distance
>
>
> you will need to use a graph exploration algorithm like Dijkstra with a
> shortest weighting and specify the weight limit to the distance you want
>
> > edgeIterator.setDistance(*distance*);
>
> oh, that should throw an exception if called before 'next' as this sets
> the distance for one specific edge not for the iterator
>
> Peter
>
>
> _______________________________________________
> GraphHopper mailing list
> GraphHopper at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/graphhopper
>
>


-- 
B*e * the *Ch*ange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150309/9428a1e6/attachment.html>


More information about the GraphHopper mailing list