Graph database practice series (II) -- Neo4J Spatial Data Storage

Source: Internet
Author: User
Tags install neo4j postgis git commands neo4j

Last Review: introduced the concept and installation of Neo4j, and introduced two tools: Git and Maven. This article describes the Neo4j Spatial project and space data (vector) storage.

1. Introduction to Neo4j Spatial 1.1Neo4j Spatial concept

The Neo4j Spatial Project is a plug-in of the graph database Neo4j. It maps Spatial data to the graph model and stores objects and relationships as vertices and edges in the graph model. Therefore, Neo4j can import, store, and query spatial data [8]. The geographical elements supported by Neo4j Spatial comply with OpenGIS specifications [9], including point, line-string, polygon, and multipoint ), simple elements such as multi-linestring. Neo4j Spatial uses the R tree as the Spatial index, mainly integrating the Lucene index library. Supported Spatial queries include cover, cover by, and contian ), intersect. Generally, the R tree groups the geometric elements of the leaf node (COUNT, LEVEL, <OIi, MBRi>) and uses their data rectangles to represent them, compared with PostGIS's optimization of GisT [13] indexes, Neo4j is less efficient in range query than PostGIS, but it is suitable for graph model data (such as network data) high operation efficiency [14]. To sum up, Neo4j has great advantages in the analysis of graph data models such as adjacent searches and path analysis.

Neo4J graph database practice series

Graph database practice series (1)-introduction and installation of Neo4J

Graph database practice series (II) -- Neo4J Spatial Data Storage

Graph database practice series (iii) -- REST integration of Neo4j Spatial

1.2 Neo4j Spatial features

Some core features of Neo4j Spatial include:

  • Esri Shapefile and OSM (OpenStreetMap) formats are supported (only. osm formats are supported)
  • Supports all common geometric elements
  • Supports topology operations during space Query
  • Allows space operations on any graph data
  • Split a single layer or dataset into multiple child Layers
2. Install Neo4j Spatial 2.1 install EGit

EGit is a Git plug-in provided by the Eclipse team. It is implemented based on JGit (java implementation version of Git) and allows various Git commands in Eclipse [15]. Like other plug-ins, choose Help> Install New Software in eclipse to add the Update siteThe http://download.eclipse.org/egit/updates is shown in 1:

Figure 1 install EGit

If the installation is successful, restart Eclipse. File-> New-> Other, you will see the Git words.

2.2 install M2eclipse

M2eclipse is the Eclipse plug-in of Maven. The goal of the project is to provide first-class Maven support for Eclipse, so that it can easily edit POM files and build projects [16]. You can also use the Update Site to install: http://download.eclipse.org/policy/m2e/releases. 2:

Figure 2 install M2Eclipse

If the installation is successful, restart Eclipse. File-> New-> Other, you can see the words Maven.

2.2Neo4j Spatial Installation

The source code of Neo4j Spatial can be downloaded from Github. We use the two plug-ins installed above to build and install our Neo4j Spatial project. First, import the Git project in File in eclipse,

File-> Import-> Git-> Project from Git. If a Local Git library already exists, select Local. We can remotely download Spatial and select URI, as shown in 3.

Figure 3 remote database selection

Enter the Neo4j Spatial URI and Next, as shown in-4:

Figure 4 input URI

EGit will automatically Fetch all source code. We can select a specific version as needed, and then Next. 5:

Figure 5 select Source code version

Next until the imported project type is selected, select Import as general projcet.6:

Figure 6 import a project

Next, click finish to complete the export of neo4j spatial. In this case, you need to Convert the Project to a Maven Project, select the Project, right-click Configure-> Convert to Maven Project, and finally get a maven Project under git management. Run the following command to install Neo4j Spatial.

 
mvn clean install
 

In eclipse, Run as-> 5. Maven Build-> enter the Build target. 7:

Figure 7 create a Neo4j Spatial Project

M2eclipse automatically builds the project. If the installation fails, run the following command to skip the unit test.

 
mvn clean install -DskipTests
 

Finally, the eclipse console reports build success.

  • 1
  • 2
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.