We are using the Low Level API and have created a custom graph from our own Maps data. The Graph nodes have Latitude and Longitude data while the edges have our custom edge weights (defined by the Cost incurred to traverse that edge).
We are successfully able to get the Shortest Path (Dijkstra) between any two Nodes on the Graph. However when we provide a Point location (Lat/Long) then we are not able to get the Nearest Node (returns -1)/Nearest Edge (returns NULL) on graph using the Location Index. We have verified that the points provided by us are nearby some of the nodes on Graph (i.e. Distance << MaxRegionSearch*Resolution).
Code snippet below:
LocationIndex index = new LocationIndexTree(graph.getBaseGraph(), new RAMDirectory(graphFolder, true)); index.setResolution(res); ((LocationIndexTree) index).setMaxRegionSearch(50); if (!index.loadExisting()) index.prepareIndex(); return index.findClosest(lat, lon, EdgeFilter.ALL_EDGES);
Kindly help with what could be the issue?