Php Neo4j Spatial 3.0.2:无索引提供程序';空间';建立

Php Neo4j Spatial 3.0.2:无索引提供程序';空间';建立,php,curl,neo4j,neo4j-spatial,Php,Curl,Neo4j,Neo4j Spatial,我正在尝试使用neo4j 3.0.2和neo4j spatial for 3.0.2创建一个空间数据库。我已经安装了插件,并且检查了插件是否使用cURLcURL-v运行http://neo4j:neo4j@localhost:7474/db/data/它输出以下内容: { "extensions" : { "SpatialPlugin" : { "addSimplePointLayer" : "http://localhost:7474/db/data/ext/Spati

我正在尝试使用neo4j 3.0.2和neo4j spatial for 3.0.2创建一个空间数据库。我已经安装了插件,并且检查了插件是否使用cURL
cURL-v运行http://neo4j:neo4j@localhost:7474/db/data/
它输出以下内容:

{
  "extensions" : {
    "SpatialPlugin" : {
      "addSimplePointLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer",
      "addNodesToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodesToLayer",
      "findClosestGeometries" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findClosestGeometries",
      "addGeometryWKTToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer",
      "findGeometriesWithinDistance" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance",
      "addEditableLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addEditableLayer",
      "addCQLDynamicLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addCQLDynamicLayer",
      "addNodeToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer",
      "getLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/getLayer",
      "findGeometriesInBBox" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesInBBox",
      "updateGeometryFromWKT" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/updateGeometryFromWKT",
      "findGeometriesIntersectingBBox" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesIntersectingBBox"
    }
  },
  "node" : "http://localhost:7474/db/data/node",
  "relationship" : "http://localhost:7474/db/data/relationship",
  "node_index" : "http://localhost:7474/db/data/index/node",
  "relationship_index" : "http://localhost:7474/db/data/index/relationship",
  "extensions_info" : "http://localhost:7474/db/data/ext",
  "relationship_types" : "http://localhost:7474/db/data/relationship/types",
  "batch" : "http://localhost:7474/db/data/batch",
  "cypher" : "http://localhost:7474/db/data/cypher",
  "indexes" : "http://localhost:7474/db/data/schema/index",
  "constraints" : "http://localhost:7474/db/data/schema/constraint",
  "transaction" : "http://localhost:7474/db/data/transaction",
  "node_labels" : "http://localhost:7474/db/data/labels",
  "neo4j_version" : "3.0.2"
* Connection #0 to host localhost left intact
}* Closing connection #0
// 2. Create a spatial index
$request = $client->request('POST',
    '/db/data/index/node/',
    [
        'json' => [
            'name' => 'geom',
            'config' => [
                'provider' => 'spatial',
                'geometry_type' => 'point',
                'lat' => 'lat',
                'lon' => 'lon',
            ],
        ],
    ]
);

var_dump($request);
现在我可以创建一个新的simplePointLayer:

// define entity manager
$client = $this->get('neo4j.spatial_manager')->getClient();



// 1. Create a pointlayer
$request = $client->request('POST',
    '/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer',
    [
        'json' => [
            'layer' => 'geom',
            'lat' => 'lat',
            'lon' => 'lon',
        ],
    ]
);

var_dump($request);
这将使用rTree创建空间根节点。但当我现在想要创建一个具有以下内容的空间索引时:

{
  "extensions" : {
    "SpatialPlugin" : {
      "addSimplePointLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer",
      "addNodesToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodesToLayer",
      "findClosestGeometries" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findClosestGeometries",
      "addGeometryWKTToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addGeometryWKTToLayer",
      "findGeometriesWithinDistance" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance",
      "addEditableLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addEditableLayer",
      "addCQLDynamicLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addCQLDynamicLayer",
      "addNodeToLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer",
      "getLayer" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/getLayer",
      "findGeometriesInBBox" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesInBBox",
      "updateGeometryFromWKT" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/updateGeometryFromWKT",
      "findGeometriesIntersectingBBox" : "http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/findGeometriesIntersectingBBox"
    }
  },
  "node" : "http://localhost:7474/db/data/node",
  "relationship" : "http://localhost:7474/db/data/relationship",
  "node_index" : "http://localhost:7474/db/data/index/node",
  "relationship_index" : "http://localhost:7474/db/data/index/relationship",
  "extensions_info" : "http://localhost:7474/db/data/ext",
  "relationship_types" : "http://localhost:7474/db/data/relationship/types",
  "batch" : "http://localhost:7474/db/data/batch",
  "cypher" : "http://localhost:7474/db/data/cypher",
  "indexes" : "http://localhost:7474/db/data/schema/index",
  "constraints" : "http://localhost:7474/db/data/schema/constraint",
  "transaction" : "http://localhost:7474/db/data/transaction",
  "node_labels" : "http://localhost:7474/db/data/labels",
  "neo4j_version" : "3.0.2"
* Connection #0 to host localhost left intact
}* Closing connection #0
// 2. Create a spatial index
$request = $client->request('POST',
    '/db/data/index/node/',
    [
        'json' => [
            'name' => 'geom',
            'config' => [
                'provider' => 'spatial',
                'geometry_type' => 'point',
                'lat' => 'lat',
                'lon' => 'lon',
            ],
        ],
    ]
);

var_dump($request);
我遇到了错误消息:

"message" : "No index provider 'spatial' found. 
我做错了什么?我检查了很多论坛等等,但答案似乎总是安装spatial插件,我已经安装了,而且它似乎是根据第一次输出工作的

编辑2016年6月15日

奇怪的是,我可以将节点添加到rTree:

   // Create a node with spatial data
    $json = [
        'team' => 'REDBLUE',
        'name' => 'TEST',
        'lat' => 25.121075,
        'lon' => 89.990630,
    ];
    $response = $client->request('POST',
        '/db/data/node', 
        [
            'json' => $json
        ]
    );

    $node = json_decode($response->getBody(), true)['self'];

   // Add the node to the layer
   $response = $client->request('POST',
        '/db/data/ext/SpatialPlugin/graphdb/addNodeToLayer',
        [
            'json' => [
                'layer' => 'geom',
                'node' => $node,
            ],
        ]
    );

    $data = json_decode($response->getBody(), true);

    var_dump($data);
我可以通过REST查询节点:

    $request = $client->request('POST',
        '/db/data/ext/SpatialPlugin/graphdb/findGeometriesWithinDistance',
        [
            'json' => [
                'layer' => 'geom',
                'pointX' => 89.99506,
                'pointY' => 25.121260,
                'distanceInKm' => 10,
            ],
        ]
    );

$data = json_decode($request->getBody(), true);

var_dump($data);
但为什么不让我创建索引呢?或者它会自动建立索引吗?如果是这样,我如何使用CYPHER进行查询(例如在web控制台中)


任何帮助都将不胜感激!Cheers

索引提供程序被删除(当时它是提供与Cypher集成的唯一方法),支持用户定义的空间索引过程

见:


由于这是一个新的主要版本(3.0版),我们认为删除索引提供程序是明智的。

感谢这一重要信息!那么,我该如何使用Cypher进行空间查询呢?如果我尝试
调用spatial.withintance('geom',{pointX:89.99506,pointY:25.121260},100)
我得到错误:
调用过程失败
spatial.withinDistance
:原因:java.lang.NoClassDefFoundError:org/neo4j/cypher/internal/compiler/v3_0/commands/expressions/georographicpoint
使用默认值创建所有调用命令时也会出现相同的错误:
callspatial.addPointLayer('geom')
然后
创建(n:Tile{name:'
test',纬度:47.99,经度:7.886})`最后:
将(t:Tile)与t call spatial.addNode('geom',t)匹配,生成节点返回计数(*)
。如果我随后使用以下命令进行查询:
callspatial.withindance('geom',{纬度:47.60,经度:7.7},100)