A No-Code Method of Mapping UFO Sightings with TigerGraph’s Geospatial Layout Feature

Using TigerGraph’s Geospatial Layout Feature with a Custom Dataset

Shreya Chaudhary
Towards Data Science

--

Introduction

Overview

In the previous blog, we leveraged TigerGraph’s COVID-19 Starter Kit to map TravelEvents with the geospatial layout feature. Let’s now see how to use the geospatial layout feature for a custom dataset. In this case, we will be used Kaggle’s UFO sighting dataset. Let’s jump into it!

Itinerary

  • Introduction
  • Set Up a TigerGraph 3.2 Solution
  • Create the Schema
  • Prepare and Load the Data
  • Map the Sightings
  • Next Steps

Tools and Resources

Step I: Set Up a TigerGraph 3.2 Solution

First, we’ll spin up a free TigerGraph 3.2 Cloud solution. To do so, navigate to https://tgcloud.io/ and log in or register.

On the left-hand sidebar, select “My Solutions” then press the blue “Create Solution” button.

Click “My Solutions” then “Create Solution” (Image by Author)

On the first page, ensure your version is 3.2 and select the Blank starter kit. Press Next.

Create a Blank, 3.2 Solution (Image by Author)

Don’t change anything on the second page. This is, in essence, just creating a free solution for you.

Leave the second page as is (Image by Author)

On the third page, update the information for your specific solution.

Update this to your solution (Image by Author)

Finally, on the fourth step, verify that everything looks good then press “Submit.”

Double-check everything and submit! (Image by Author)

Wait till your status turns green then launch GraphStudio by pressing the four squares and selecting “GraphStudio” from the dropdown.

When your status turns green, press the four squares then click “GraphStudio” from the dropdown (Image by Author)

Perfect! You’re now ready to create your schema.

Step II: Create the Schema

Let’s first create the schema based on the data. To do so, click “Global View” then create a new graph (which I called UFO).

Click “Global View” and Press “Create a graph” from the dropdown (Image by Author)
Enter the Graphname (such as “UFO”) (Image by Author)

To start designing the schema, press the “Design Schema” tab.

Click into the “Design Schema” Tab (Image by Author)

To add (local) vertices, press the plus button on the top and edit the attributes appropriately.

Press the plus to add a local vertex (Image by Author)
Update the attributes appropriately. (Image by Author)

To add edges, click on the arrow and then click the two vertices you wish to connect.

Add a local edge with the arrow and click the two vertices you want to connect (Image by Author)
Edit the attributes as appropriate (Image by Author)

As for the schema design, while we could make it far more complicated, I opted to break apart the country, state, and city into vertices (with their values as the primary id and the attribute) and add the rest of the data into a Sighting vertex with a primary id of the DateTime.

Schema of the Graph (Image by Author)
Attributes of the Sighting Vertex (Image by Author)

Once the schema is created, press the up arrow to publish the schema, and you’re ready to progress to the next step!

Press the up arrow to publish the schema (Image by Author)

Step III: Prepare and Load the Data

Next, I downloaded the complete.csv file from Kaggle UFO Sighting Dataset and uploaded it into GraphStudio. To do so, navigate to the “Map Data to Graph” tab and click the “Add data file” option.

Navigate to the “Map Data” tab and click the “Add data file” option. (Image by Author)

Press the plus, upload the CSV, then add it.

Select the CSV then press the “Add” button. (Image by Author)

I then mapped the CSV to the appropriate vertices and edges. You can do so by clicking the CSV, pressing the crossing arrows with the hover data of “Map data file to vertex or edge,” and then mapping the data appropriately.

Map the data (Image by Author)

Finally, I loaded the data into the graph by navigating to “Load Data” and pressing the play button.

Go to the “Load Data” tab and press the play button. (Image by Author)

Afterward, in graph statistics, you should see all of the vertices and edges now in the graph.

You should see the vertices and edges in the graph (Image by Author)

Perfect! Now we can map the data.

Step IV: Map the Sightings

Finally, using the “Explore Graph” tab, I mapped the data. I first selected 100 Sightings.

Navigate to “Explore Graph” and select 100 Sighting vertices. (Image by Author)

Next, I clicked force and chose the geospatial map option. And, with that, the vertices were in place!

Results of Mapping (Image by Author)

From this, I can tell that the majority of the UFO sightings, at least from this sample, is from the USA. I explored more of the data and zoomed in on the USA to learn more about those sightings in particular.

Just the USA Map (Image by Author)

From here, I can finetune my data explorations and more, all in GraphStudio without writing a single line of code.

Step V: Next Steps

Perfect! Now that you used the geospatial mapping feature on this custom graph, you can now easily use it in your own projects. If you have any questions or run into any errors, feel free to post them in the community forum.

Additionally, you can chat with more TigerGraph developers on the community Discord.

Good luck with using the maps in your projects, and I can’t wait to see what awesome projects you create!

Data Source

The data used was from Kaggle here, and the license is not specified. This dataset was scraped, geolocated, and time standardized from NUFORC data by Sigmond Axel here.

--

--