I think there's a problem in the OSMImporter.reIndex method. Look for
the two '>>>>>' for the problem:
public void reIndex(GraphDatabaseService database, int
commitInterval, boolean includePoints, boolean includeRelations) {
if (commitInterval < 1)
throw new IllegalArgumentException("commitInterval must be
>= 1");
System.out.println("Re-indexing with GraphDatabaseService: " +
database + " (class: " + database.getClass() + ")");
setLogContext("Index");
SpatialDatabaseService spatialDatabase = new
SpatialDatabaseService(database);
OSMLayer layer =
(OSMLayer)spatialDatabase.getOrCreateLayer(layerName,
OSMGeometryEncoder.class, OSMLayer.class);
// TODO: The next line creates the relationship between the dataset
and
// layer, but this seems more like a side-effect and should be done
// explicitly
OSMDataset dataset = layer.getDataset(osm_dataset);
layer.clear(); // clear the index without destroying
underlying data
long startTime = System.currentTimeMillis();
Traverser traverser =
database.getNodeById(osm_dataset).traverse(Order.DEPTH_FIRST,
StopEvaluator.END_OF_GRAPH,
ReturnableEvaluator.ALL_BUT_START_NODE,
OSMRelation.WAYS, Direction.OUTGOING, OSMRelation.NEXT,
Direction.OUTGOING);
Transaction tx = database.beginTx();
>>>>> boolean useWays = false;
int count = 0;
try {
layer.setExtraPropertyNames(stats.getTagStats("all").getTags());
>>>>> if (useWays) {
beginProgressMonitor(dataset.getWayCount());
for (Node way : traverser) {
updateProgressMonitor(count);
incrLogContext();
stats.addGeomStats(layer.addWay(way, true));
if (includePoints) {
Node first = way.getSingleRelationship(OSMRelation.FIRST_NODE,
Direction.OUTGOING).getEndNode();
for (Node proxy : first.traverse(Order.DEPTH_FIRST,
StopEvaluator.END_OF_GRAPH, ReturnableEvaluator.ALL,
OSMRelation.NEXT, Direction.OUTGOING)) {
Node node = proxy.getSingleRelationship(OSMRelation.NODE,
Direction.OUTGOING).getEndNode();
stats.addGeomStats(layer.addWay(node, true));
}
}
if (++count % commitInterval == 0) {
tx.success();
tx.finish();
tx = database.beginTx();
}
} // TODO ask charset to user?
} else {
beginProgressMonitor(dataset.getChangesetCount());
for (Node changeset : dataset.getAllChangesetNodes()) {
updateProgressMonitor(count);
incrLogContext();
for (Relationship rel :
changeset.getRelationships(OSMRelation.CHANGESET, Direction.INCOMING))
{
stats.addGeomStats(layer.addWay(rel.getStartNode(), true));
}
if (++count % commitInterval == 0) {
tx.success();
tx.finish();
tx = database.beginTx();
}
} // TODO ask charset to user?
}
tx.success();
} finally {
endProgressMonitor();
tx.finish();
}
long stopTime = System.currentTimeMillis();
log("info | Re-indexing elapsed time in seconds: " + (1.0 *
(stopTime - startTime) / 1000.0));
stats.dumpGeomStats();