确切的查询:
call spatial.bbox('geom', {lat:37.5,lon:43.4}, {lat:37.6,lon:43.5}) yield node return node.altitude as altitude, node.detect_type as detect_type, node.gtype as gtype, node.toDateFormatLong as toDateFormatLong, node.change_area as change_area, node.latitude as latitude, node.longitude as longitude, node.fromDateFormatLong as fromDateFormatLong, node.iids as iids, node.detect_strength as detect_strength, node.fromDate as fromDate, node.bbox as bbox ORDER BY node.toDateFormatLong DESC
Run Code Online (Sandbox Code Playgroud)
示例数据集:
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?"altitude"?"detect_type"?"gtype"?"toDateFormatLong"?"change_area"?"latitude"?"longitude"?"fromDateFormatLong"?"iids" ?"detect_strength"?"fromDate"?"bbox" ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?-1 ?"Arrival" ?1 ?20161104 ?16981 ?37.5608649?43.4297988 ?20161023 ?"23OCT16S1A89377_09_IW1_09_pp_1231_04NOV16S1A90776_09_123_31_TT_QQQQ”?7.2 ?"23OCT16" ?[43.4297988,37.5608649,43.4297988,37.5608649]?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?-1 ?"Arrival" ?1 ?20161104 ?3123 ?37.56749 ?43.4807208 ?20161023 ?"23OCT16S1A89377_09_IW1_09_pp_1231_04NOV16S1A90776_09_124_32_TT_QQQQ"?7.5 ?"23OCT16" ?[43.4807208,37.56749,43.4807208,37.56749] ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)
我打电话给你
try …Run Code Online (Sandbox Code Playgroud) 首先,这是我的堆栈描述:
我有单位节点,它们使用属性"position"进行地理定位.位置是几何(POINT,CIRCLE或POLYGON).
我在这个属性上创建了一个图层和一个索引.我可以添加一个地理位置单位.这很好用.这是我之前的问题,我解决了它,因为它隐藏了真实的问题.
现在,我需要定义一些其他地理对象,如"path","detectionZone"或"actionZone".操作通常是"哪个其他单位在行动区?" 或"单位路径穿过检测区域?"
我如何索引这些数据?每个房产的一个指数?或者"wkt"属性的索引和用于检测区域,动作区域和路径的新节点,具有wkt属性?
我是否需要为每个地理概念创建一个图层?或者是一个独特的"geom"图层,它将所有与空间相关的节点分组?
我有点难过.
在我的数据库中,我有这样的关系:
(u:User)-[r1:LISTENS_TO]->(a:Artist)<-[r2:LISTENS_TO]-(u2:User)
Run Code Online (Sandbox Code Playgroud)
我想执行一个查询,对于给定的用户,我找到该用户和每个其他用户之间的常见艺术家.
为了了解我的数据库的大小,我有大约600个用户,47,546位艺术家,以及184,211用户和艺术家之间的关系.
我尝试的第一个查询如下:
START me=node(553314), other=node:userLocations("withinDistance:[38.89037,-77.03196,80.467]")
OPTIONAL MATCH
pMutualArtists=(me:User)-[ar1:LISTENS_TO]->(a:Artist)<-[ar2:LISTENS_TO]-(other:User)
WHERE
other:User
WITH other, COUNT(DISTINCT pMutualArtists) AS mutualArtists
ORDER BY mutualArtists DESC
LIMIT 10
RETURN other.username, mutualArtists
Run Code Online (Sandbox Code Playgroud)
这需要大约20秒才能返回.此查询的配置文件如下:
+----------------------+-------+--------+------------------------+------------------------------------------------------------------------------------------------+
| Operator | Rows | DbHits | Identifiers | Other |
+----------------------+-------+--------+------------------------+------------------------------------------------------------------------------------------------+
| ColumnFilter(0) | 10 | 0 | | keep columns other.username, mutualArtists |
| Extract | 10 | 20 | | other.username |
| ColumnFilter(1) | 10 | 0 | | keep columns other, mutualArtists |
| …Run Code Online (Sandbox Code Playgroud) 我无法在我的界面中为 Neo4j 空间插件导入JavaSpatialRepository和GraphRepositoryJava。
我必须使用neo4j-spatial 插件将多边形数据添加到neo4j 数据库中。为此我使用wkt 格式。但是由于我的 pom.xml 中的版本不匹配,没有导入任何内容。
我曾尝试更改空间插件的版本,但仍然无济于事。我正在使用嵌入式驱动程序。
我正在添加完整的 pom.xml 配置。
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.neo4j</groupId>
<artifactId>Neo4j</artifactId>
<version>0.25.5-neo4j-3.3.5</version>
<packaging>jar</packaging>
<name>Neo4j</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j</artifactId>
<version>3.3.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.neo4j</groupId> …Run Code Online (Sandbox Code Playgroud) 我正在尝试开发一个Web服务,能够返回包含给定gps位置的管理区域的名称.
我已经开发了一个java应用程序,它能够使用空间插件和Java API在neo4j中插入一些多边形(我国的行政区域).然后,给出一个gps位置,我能够得到包含它的多边形的名称.
现在我正在尝试使用Neo4j的REST API(而不是java api),但我找不到任何示例.
所以我的问题是:
1)是否可以使用REST API在Neo4j中插入多边形(如果我可以理解使用WKT格式)?
2)是否可以执行空间查询,查找包含给定gps位置的所有多边形?
谢谢,恩里科
我正在学习多个教程并且都演示了相同的Cypher查询,所以它必须是正确的,但我收到以下错误:
Neo.ClientError.Statement.SyntaxError未知的过程输出:
node
码:
call spatial.addWKTLayer('geom', 'wkt')
------- THEN --------
MATCH (v:Venue) WITH collect(v) as venues
CALL spatial.addNodes('geom', venues)
YIELD node
RETURN count(*)
Run Code Online (Sandbox Code Playgroud)