menome / kepler4Neo

Load data from a Neo4J database into a kepler.gl map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kepler4Neo

MIT License

kepler4Neo is an application that lets you easily transfer data from a Neo4J database on to a kepler.gl map. Use kepler4Neo to quickly build dynamic visualizations of your geospatial Neo4J data.

Features

kepler4Neo provides a user interface at the bottom of the webpage. You can use this interface to connect to your Neo4J database and send queries to add data to your map. The kepler.gl map instance remains unaltered, allowing you to take advantage of all its visualization features.

Connect to Neo4J

Connect to any active Neo4J database by inputting the database URL and credentials from the 'Connect to database' screen.

Perform Query

Send a cypher query to your current Neo4J database

Setup

  1. Clone the kepler4Neo repository onto your device.
  2. Retrieve a Mapbox API token
  3. Create a .env file within the main directory of your kepler4Neo project.
  4. Insert your mapbox API token into your .env file using the name REACT_APP_MAPBOX_API_TOKEN.

REACT_APP_MAPBOX_API_TOKEN=<YourToken>

  1. To launch kepler4Neo, navigate to the kepler4Neo folder and type npm start with a command terminal.

You can input default credentials to automatically log in to a specific database whenever the app is launched. To do this, simply change the values of neoRoute, startUsername, and startPassword from within neo4jConnection.js.

Usage

Run the website at localhost:3000 using npm start.

From the 'Connect to database' tab, connect to the Neo4J database of your choice. You should use a Bolt URL to connect with your Neo4J database. Once you have successfully connected you should see a success message.

Once you have connected to a database, navigate to the 'Perform Query' tab. Within the Neo4J Query box, enter your cypher query. Ensure that you are using descriptive names for your return types.

Now, specify a name and an ID for your data. The data name will be the name of your dataset within kepler.gl. The ID uniquely identifies the dataset you are uploading - if you would like to overwrite it in the future, you can perform another query using the same ID.

Finally, specify the return types of the data that you expect your cypher query to return. Ensure the return types appear in the order that your cypher query would return them.

Once you have correctly filled every field, press submit and your data will automatically upload to the kepler.gl map.

Example

In this example, we will be using the Contact Tracing database available from Neo4J Sandbox. After launching the Neo4J database, we need to login.

Login Screen

Now, we can write our query.

A screenshot of writing the query

The cypher for our query is

MATCH (v:Visit)-[:LOCATED_AT]->(l:Place) RETURN l.name AS name, l.homelocation.x AS latitude, l.homelocation.y AS longitude, v.starttime AS startime

Once you click submit, the data should upload to your map automatically. From here, you can use kepler.gl to create dynamic data visualizations.

The data uploaded to kepler.gl

Data Formatting

Your data from Neo4J should be formatted according to kepler.gl specifications. Ensure that your returned data matches the data types available from the drop-down menu (Real Number, Date, Integer, String, GeoJSON, or Timestamp). If it doesn't, you can use Neo4J functions within your query to ensure your data is in an appropriate format.

In order to use kepler.gl's time playback feature, your temporal data must be formatted as a timestamp (dates without times cannot use time playback in the current version of kepler.gl). You can use kepler's temporal functions to accomplish this. For example, to convert a date into a datetime, the following function can be used:

WITH date({year:1984, month:10, day:11}) AS dd RETURN datetime({date:dd, hour: 0, minute: 0, second: 0}) AS myDateTime

This may be updated in a future version of kepler.gl.

License

This project uses a MIT license.

About

Load data from a Neo4J database into a kepler.gl map

License:MIT License


Languages

Language:JavaScript 75.0%Language:CSS 20.0%Language:HTML 3.2%Language:Dockerfile 1.9%