Simple Weather Application with Geolocation

I have created a weather application that uses geolocation.
What can I do to improve it?

You can search by:

  • zip code/post code
  • town, state
  • street, town, state
  • city, country

Test on cell phone and desktop if you can. It fits on mobile sized devices.

https://simpleweatherreport.herokuapp.com/

View Code

Add search option for post code

@KittyKora Isn’t the post code and zip code the same thing?

Yes but no
According to Google:
A postcode and a zip code are essentially the same thing – an alphanumeric code assigned to every address or location, most typically to help the post office deliver the mail. The difference is that the USA uses the term zip code and the UK and some other countries use postcode or postal code .
Since it needs to be usser friendly
This does matter if someone where to ask me hey what is your zip code i would’t have a clue because we don’t use that term here

1 Like

It looks good @brandon_wallace. One question, is there a way to sync it with the user’s time zone? For instance, I’m on the east coast, USA and the time displays as GMT.

As an aside, there’s nothing on the page that refers to ZIP code/postal code so it seems to be a moot point.

1 Like

Thanks for taking the time to view my project.

@Roma Yes, I see the time is off a bit by a few hours, even the sunrise/sunset is off but it is sometimes displays correctly. It is supposed to display the time and sunset/sunrise of the location. I will have to check that out.

@KittyKora the zip code and postal code both work for geolocation.

@Roma I have fixed the timezone issue. I had to use the pytz library to properly convert the time. Here is the change I made in the code.

Old code:

sunrise = datetime.fromtimestamp(data['daily']['data'][0]['sunriseTime']).strftime('%Hh:%Mm')
sunset = datetime.fromtimestamp(data['daily']['data'][0]['sunsetTime']).strftime('%Hh:%Mm')

New code:

tzone = data['timezone']
sunrise = datetime.fromtimestamp(data['daily']['data'][0]['sunriseTime'], tz=pytz.timezone(tzone)).strftime('%Hh:%Mm')
sunset = datetime.fromtimestamp(data['daily']['data'][0]['sunsetTime'], tz=pytz.timezone(tzone)).strftime('%Hh:%Mm')