Neo4j Spatial 3.0.2:没有找到索引提供者的'spatial' [英] Neo4j Spatial 3.0.2: No index provider 'spatial' found

查看:422
本文介绍了Neo4j Spatial 3.0.2:没有找到索引提供者的'spatial'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用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: graphdb / addNodesToLayer,
addGeometryWKTToLayer:http:// localhost:7474 / db / data / ext / SpatialPlugin / graphdb / findClosestGeometries,
findClosestGeometries 7474 / db / data / ext / SpatialPlugin / graphdb / addGeometryWKTToLayer,
findGeometriesWithinDistance:http:// localhost:7474 / db / data / ext / SpatialPlugin / graphdb / findGeometriesWithinDistance,
addSystem:addEditableLayer:http:// localhost:7474 / db / datadb / addEditableLayer,
addCQLDynamicLayer: graphdb / addCQLDynamicLayer,
addNodeToLayer:http:// localhost:7474 / db / data / ext / SpatialPlugin / graphdb / addNodeToLayer,
getLayer:http: 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: dbdb// db / data / node,
关系:http:// localhost:7474 / db / data / node,dbdb / findGeometriesIntersectingBBox
}
} // localhost:7474 / db / data / relationship,
node_index:http:// localhost:7474 / db / data / index / node,
ationship_index:http: // localhost:7474 / db / data / index / relationship,
extensions_info:http:// localhost:7474 / db / data / ext,
ationship_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
*连接#0到主机localhost保持原样
} *关闭连接#0

现在我可以创建一个新的simplePointLayer:

  //定义实体管理器
$ client = $ this-> get('neo4j.spatial_manager') - > getClient



// 1.创建点对象
$ request = $ client-> request('POST',
'/ db / data / ext / SpatialPlugin / graphdb / addSimplePointLayer',
[
'json'=> [
'layer'=>'geom',
'lat'=> 'lat',
'lon'=>'lon',
],
]
);

var_dump($ request);

这将使用rTree创建空间根节点。但是,当我现在想创建一个空间索引与下面的:

  // 2.创建空间索引
$ 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:找不到索引提供者空间


$ b b

我做错了什么?我已经检查了很多论坛等,但答案总是似乎是安装空间插件,我已经,它似乎是根据第一个输出工作。 / p>

EDIT 15.06.2016



很奇怪的是, rTree:

  //使用空间数据创建节点
$ json = [
'team'= >'REDBLUE',
'name'=>'TEST',
'lat'=> 25.121075,
'lon'=> 89.990630,
]
$ response = $ client-> request('POST',
'/ db / data / node',
[
'json'=> $ json
]
);











到层的节点
$ 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集成的唯一方法)为空间定义程序。



请参阅: https://github.com/neo4j-contrib/spatial/blob/master/src/test/java/org/neo4j /gis/spatial/procedures/SpatialProceduresTest.java#L113



由于这是一个新的主要版本(对于3.0),我们发现删除索引是明智的提供者。


I am trying to create a spatial database with neo4j 3.0.2 and neo4j-spatial for 3.0.2. I have installed the plugin and I have checked that the plugin is running with cURL curl -v http://neo4j:neo4j@localhost:7474/db/data/ which outputs following:

{
  "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

Now I can create a new 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);

This creates the spatial root node with the rTree. But when I now want to create a spatial index with following:

// 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);

I am confronted with the error-message:

"message" : "No index provider 'spatial' found. 

What am I doing wrong? I have checked a lot of forums and so on, but the answer always seems to be to install the spatial plugin, which I have and it seems to be working according to the first output.

EDIT 15.06.2016

Whats weird is that I can add nodes to the 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);

And I can query the nodes through 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);

But why is it not letting me create an index? Or does it do the indexing automatically? And if so, how can I query using CYPHER (in the web console for example)?

Any help would be appreciated! Cheers

解决方案

The index provider was removed (back then it was the only means to provide integration with Cypher), in favor of user defined procedures for Spatial.

see: https://github.com/neo4j-contrib/spatial/blob/master/src/test/java/org/neo4j/gis/spatial/procedures/SpatialProceduresTest.java#L113

As this is a new major release (for 3.0) we found it sensible to remove the index provider.

这篇关于Neo4j Spatial 3.0.2:没有找到索引提供者的'spatial'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆