CotSezer / earthquake

This repository is a Java Spring Boot application that retrieves earthquake data using the USGS Earthquake API. It provides a RESTful API endpoint for querying earthquake information based on location and time range.
MIT License
1 stars 1 forks source link

update the endpoint api (add country filter) #1

Open CotSezer opened 1 year ago

uvais724 commented 1 year ago

Hi @CotSezer, I went through the codebase and the api you are using, based on what I understand I think you need a new endpoint which returns the response of the earthquake information for a particular country, let me know if I am correct.

CotSezer commented 1 year ago

Heyy @uvais724, you are correct. I am searching to get min/max latitude and longitude of the countries you filter. Because "https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime={}&endtime={}&minmagnitude=4.5&maxlatitude={}&minlatitude={}&maxlongitude={}&minlongitude={}" can be used. To apply this method, we should find a new api to get these variables of the country or prepare a file including these variables.

uvais724 commented 1 year ago

@CotSezer I tried looking for an api which gives the min and max lat long but unable to find such free api. There is one free api https://restcountries.com/v2/name/{country} which returns a latlng field (you can try it out), used this api co ordinates with the usg api but didnt get the appropriate response. Based on my findings its hard to find any country based on min max lat long as countries have different shapes and sizes. The only solution I can suggest is I was able to generate a flat file latlng.txt with the help of chat gpt with all the required lat lng fields. We can use the above file to get the lat long values and pass it to the USG api for the desired results. I tested it out and it seems to be working somewhat ok we would still require some filtering on top of the api response.

CotSezer commented 1 year ago

@uvais724 absolutely you are right. We will not always get the right result because of the countries' shapes. How can we update the api of usgs? (Thanks for your effort for the doc.)

uvais724 commented 1 year ago

Raised PR https://github.com/CotSezer/earthquake/pull/2 please review and let me know.