DEV Community

Cover image for Converting NASA's Open Data into Insights using EONET API
kainat Raisa
kainat Raisa

Posted on • Updated on

Converting NASA's Open Data into Insights using EONET API

About the Project

In this project, I have tried to convert the NASA EONET Open Data into a bit more visualized form. This is a very small project where I have accessed the Data about Earth's Natural Events using the Open EONET API from NASA and created an interactive world map.

Importing the necessary Python Libraries

Here I am importing the requests, json, pandas, folium, IPython Library of Python. If you are using Jupyter Notebook and don't have the libraries preinstalled on your desktop then just write the code in a cell below (separately for each library) :

Image description

Image description

Here I have put the API URL and URL key in two variables named as url and key, and then I have set the parameters for making the API request ( if you want to know more about the NASA Open APIs then click on this link: https://api.nasa.gov/ )

Making the API request and printing the textual part of the response

Image description

The response is returning us a JSON object (a javascript object), this format of data is almost similar to a Python dictionary.

Now we'll load the data from the json object.

Image description

Converting the title, description, and link part of the response Data into a pandas Dataframe. And then I'll check the head of the Dataframe.

Image description

As you can see all of the are in a single column in our dataframe which means they are not in the normal form so we need to normalize the dataframe.

Image description
We have normalized the dataframe using json_normalize method of the pandas dataframe.

Now we'll need to separate the event ids and category titles from the categories column.

Image description

Now we'll see how many of the different natural events happening on earth on that particular data.

Image description

Now I am using the folium library to create a world map.

Image description

I have saved the map on my desktop as an HTML file as world_natural_events_map2.html. Now I'll use the IPython library to display the map.

Image description

this is an interactive map, we can click on the markers and see further details about the events.

Top comments (0)