11

App shows earthquake data in your region (donations)

 1 year ago
source link: https://blogs.sap.com/2023/02/15/app-shows-earthquake-data-in-your-region-donations/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

The terrible earthquakes in Turkey and Syria has been on everyone’s mind. We all pray that more people are found, and that the survivors can rebuild and regain their resolve and strength.

Donate for Earthquake Relief 

Here are just 3 of the many charities you can donate to:

SAP employees should donate via the internal portal, as donations may be matched.

App with earthquake data

I was thinking what type of app I could create related to earthquakes, maybe that could help in some way. I found the U.S. Geological Survey, which includes the USGS Earthquake Hazards Program. They provide real-time earthquake information – including free APIs.

I actually knew about the services because there is a Python LinkedIn Learning course I took that uses the earthquake data as part of its tutorial.

The APIs are located here: https://earthquake.usgs.gov/fdsnws/event/1/

usgs.png

The main 2 APIs I found were:

  • A set of feeds with real-time data of the latest earthquakes (location, strength, and so forth). There are feeds for earthquakes in the last hour, day or week, and feeds for different strength earthquakes.
  • A query service that lets you query, for example, based on location, strength, and so forth.

There is also a call to get information about a specific earthquake, including all different kinds of maps. I used this for the detail screen.

Screen 1 – List of earthquakes

So I decided to build 2 screens. The first is one that displays different lists of earthquakes: A list of all magnitude 4.5 or above in the last 24 hours, and a list of the all earthquakes in the past hour.

screen1.png

You can also query for the earthquakes near a certain spot (or by clicking the button near your location), and you can set the radius from your location and the minimum magnitude.

screen2-1.png

A nice feature here would be enter a city and the app would determine its latitude and longitude.

Screen 2 – Earthquake details

I created a second, detail page to which you can navigate by clicking on any of the earthquakes in any of the lists on the first page.

Screen3.png

On the detail page is a lot of basic information, but coolest is the map to locate where the earthquake occurred.

There is also a button to take you to the USGS page where you can provide details if you felt the earthquake.

tellus.png

SAP Build Apps features

There were several SAP Build Apps features that I took advantage of to make this possible.

  • Containers: I nested containers and set the width and layouts to help me organize the and align the components:
  • Soft Tabs: A Marketplace components to help create tabs in your apps.tabs.png
  • Conditional Render: A component to create several UIs and to switch between them – used in conjunction with the soft tabs.
  • Scroll View: Lets you create an area that will scroll while the rest of page stays still, which I used for the lists of earthquakes.
  • Basic List: A core component for displaying an item in a list that includes several text fields.
  • Web View: A Marketplace component for displaying web pages, in this case, for displaying the map.
  • Open Web Browser: A Marketplace flow function for opening a web page in the device’s web browser. web-view.png
  • Page Parameters: I used the standard practice of creating a page parameter in the detail page to hold the ID of the specific item. This is passed when navigating from the home page.

Install app

I will do a tutorial about how to create this app. In the meantime, you can import the app, and maybe you can find ways to improve upon it or to make it useful for people in the field or elsewhere.

  1. Download the project.
    earth1.png
  2. Create a new app project and call it Earthquakes.
    earth2.png
  3. In the top-right of the empty app you created, click on the 3 dots and select Replace. Select the project you downloaded (.gpg), and click Replace.
    earth3.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK