Hello
I want to create the graph manually. so i follow this step to create the graph, but i receive the below error during this process and then the compiling was stooped.
MMapDirectory mapDirectory = new MMapDirectory("/home/graphhopper plugin/PostgreSqlReader/out");
GraphHopperStorage graph = createGHStorage(mapDirectory, new EncodingManager(new CarFlagEncoder()), false);
NodeAccess nodeAccess = graph.getNodeAccess();
1- first connect to database and fetch the data and store those
2- as like as shape reader i fill the node access by this function
void processJunctions() {
List dataStore = null;
try {
dataStore = postgreList;
HashSet<Coordinate> tmpSet = new HashSet<>();
for(Postgre p : dataStore){
Geometry geometry;
try {
geometry = wktReader.read(p.getGeom());
}catch (Exception e)
{
continue;
}
geometry.setSRID(4326);
for (Coordinate[] points : getCoords(geometry)) {
tmpSet.clear();
for (int i = 0; i < points.length; i++) {
Coordinate c = points[i];
// don't add the same coord twice for the same edge - happens with bad geometry, i.e.
// duplicate coords or a road which forms a circle (e.g. roundabout)
if (tmpSet.contains(c))
continue;
tmpSet.add(c);
// skip if its already a node
int state = coordState.get(c);
if (state >= FIRST_NODE_ID) {
continue;
}
if (i == 0 || i == points.length - 1 || state == COORD_STATE_PILLAR) {
// turn into a node if its the first or last
// point, or already appeared in another edge
int nodeId = nextNodeId++;
**coordState.put(c, nodeId);**
saveTowerPosition(nodeId, c);
} else if (state == COORD_STATE_UNKNOWN) {
// mark it as a pillar (which may get upgraded
// to an edge later)
coordState.put(c, COORD_STATE_PILLAR);
}
}
}
}
} catch (Exception e) {
System.out.println("SOMETHING PROBLEMS!!!!");
e.printStackTrace();
}
if (nextNodeId == FIRST_NODE_ID)
throw new IllegalArgumentException("No data found for roads file ");
LOGGER.info("Number of junction points : " + (nextNodeId - FIRST_NODE_ID));
}
3- and then process road.
I receive error from this line
coordState.put(c, nodeId);
Error: com.carrotsearch.hppc.BufferAllocationException: Not enough memory to allocate buffers for rehashing: 8,388,608 -> 16,777,216
can you help me why i receive this error and solve it?
Thanks in advance