0

是什么原因以及如何解决此异常:

org.neo4j.graphdb.NotFoundException: More than one relationship[RTREE_CHILD, INCOMING] found for NodeImpl#105
at org.neo4j.kernel.impl.core.NodeImpl.getSingleRelationship(NodeImpl.java:344)
at org.neo4j.kernel.impl.core.NodeProxy.getSingleRelationship(NodeProxy.java:191)
at org.neo4j.collections.rtree.RTreeIndex.getIndexNodeParent(RTreeIndex.java:768)
at org.neo4j.collections.rtree.RTreeIndex.adjustPathBoundingBox(RTreeIndex.java:672)
at org.neo4j.collections.rtree.RTreeIndex.add(RTreeIndex.java:90)
at org.neo4j.gis.spatial.EditableLayerImpl.add(EditableLayerImpl.java:44)
at org.neo4j.gis.spatial.ShapefileImporter.importFile(ShapefileImporter.java:209)
at org.neo4j.gis.spatial.ShapefileImporter.importFile(ShapefileImporter.java:122)

我正在使用来自已编译 github 项目的 2.0.0 和空间 jar。

当我尝试导入 Shapefile 时抛出异常(这是非托管扩展中的代码):

GraphDatabaseService spatialDb = new GraphDatabaseFactory().newEmbeddedDatabase("/home/db/data/spatial.db");
    Transaction tx = spatialDb.beginTx();
    try {
        ShapefileImporter importer = new ShapefileImporter(spatialDb, new NullListener());
        importer.importFile("/home/bla/realshp/users_location.shp", "users_location");
        tx.success();
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        tx.close();
        return Response.status(200).entity("Done. ").build();
    }

形状文件是使用 ogr2ogr 从 CSV 文件生成的 - 它看起来是合法的,并且可以毫无例外地读取。在原始文件中,大约有 30000 个点定义如下(ogr2ogr 将提取经度和纬度):

id,longitude,latitude,gender,updated
3,-122.1171925,37.4343361,1,2013-11-20 05:03:22
304,-122.0919000,37.3094000,1,2013-11-03 00:42:01
311,-122.0919000,37.3094000,1,2013-11-03 00:42:01

如何绕过它?我需要将数百万个点加载到数据库中。附带问题:现在我创建了新的图形空间数据存储 - 是否正确?也许我应该将它加载到现有的图形数据库中?

更新:

我尝试使用 TestSimplePointLayer 中的方法“手动”输入坐标。我在第 450 个坐标附近遇到了同样的异常。其中一些与您在示例中看到的相同,但它们是有效点。如何绕过它?

4

2 回答 2

0

你在这里跳过了一步。您创建一个空间索引,然后将用户添加到索引中。

因此,例如,如果您有一个包含美国所有州、县或邮政编码的形状文件,您可以使用这些形状创建一个空间图层并将用户添加到其中。

如果需要,您也可以使用简单的点图层,但它们必须是唯一的,但驻留在这些位置的用户节点不必是唯一的。见http://java.dzone.com/articles/running-along-graph-using-0http://www.markhneedham.com/blog/2013/03/10/neo4jcypher-finding-football-stadiums-near -a-city-using-spatial/以获得更好的想法。

于 2014-01-08T20:08:33.847 回答
0

当我尝试将具有相同 lon/lat (0,0) 的节点添加到图层时,我遇到了同样的错误。当插入超过 100 个 RTREE_CHILD ref 节点时,会出现此异常。这是源代码的错误。

src/main/java/org/neo4j/gis/spatial/rtree/RTreeIndex.java

试试这个分叉插件:

https://github.com/linkedin-inc/spatial
于 2015-06-22T16:48:04.230 回答