How to make a weather website?
November 7, 2021 2:54 AM   Subscribe

Let's say that I'm a beginning coder and I want to make a simple weather forecast website. How would I start? I assume I'd be using openweathermap api. What else do I need to know?
posted by matkline to Technology (8 answers total) 1 user marked this as a favorite
This question is incredibly broad, so I’d start with a couple of high-level things: you’ll need to know your programming language(s), your tech stack (front end, back end, database) and your deployment strategy (Heroku is a good choice for beginners).
posted by sevensnowflakes at 4:44 AM on November 7, 2021 [1 favorite]

I agree with sevensnowflakes, the question is really broad and thus kind of hard to answer because it will depend a lot in where you are and what you know.

I’d add that apart from tech stack, you’d need to define more the features of the website you want to make and how those can be matched to what openweathermap api offers you. Maybe you could take a look into what the national weather service offers (, assuming US), or the equivalent weather authority for your area. These places often offer more detailed data that other api.

Either way, keep in mind checking how often you’d be accessing that data, either from an api or otherwise because you’d likely like to avoid being banned or something (assuming a lot of traffic, or loops that make hundreds of request per second)

Hope this helps but if you clarify more your questions we could provide a better answer.

Good luck!
posted by _benj at 5:18 AM on November 7, 2021

One way to start would be to do a search on "tutorial weather forecast website" and see what comes up. Then read the articles or watch the videos and get an idea of what's involved.

Next you'll want to set up your own developer tools (for example an integrated development environment like Visual Studio Code), copy some of the code from a tutorial and get it running on your own computer.

From there you can experiment - change the code in certain ways to see what happens, and try to add your own features. Do you want people to choose a city from a drop-down list? Do you want your app to remember their location using cookies?

If you get stuck, you might want to take some time working through an online course in Javascript (for example) to get some basics down before you continue.
posted by Umami Dearest at 5:23 AM on November 7, 2021

While agreeing that this question is very broad, a few rough things you’d need to consider, assuming the above basics are sorted out:

* How to get the user’s location. Ask for permission in the browser to get their location. If/when they don’t give it, then you need to know how to turn their zip code, address, or anything else they type in into a location (there are geolocation APIs to help with this.

* You’ll want to cache the data you get back from the weather API to reduce the number of times you request the same data. In a database? How?

* Can the user set a list of favourite locations? Is this saved in their browser, and/or can they create an account? If the latter that opens up a lot of other things to know how to do.

*Similarly, can the user set their preferred units for temperature, wind speed, etc? If so, how do those get stored?

* Once you’ve got weather data from the API, how do you display it? Maps? Charts? What do you use to make those?
posted by fabius at 5:38 AM on November 7, 2021

All excellent advice above. If you were to use JavaScript, the Fetch API can help you request the weather data from openweathermap. In my opinion Python is an excellent beginner language and it's what I would suggest using if you're brand new to programming. For Python you could use the Requests library to get the data from openweathermap. If you choose to write this in Python it's probably best to get a Python script working first and then graduate to Python web frameworks like Flask or Django. I second Heroku as a free platform to deploy web apps. There are a lot of details I left out and these are best described in tutorials on the web that can be found by searching for keywords like "Python requests rest api". Here's one tutorial to get you started. The tutorial may be a bit much for beginners. Try to focus on the GET requests and JSON portions of the tutorial.
posted by mundo at 5:48 PM on November 7, 2021

Best answer: You might find something useful by looking in (previously mentioned in a few replies to this old thread). (IANAD)
posted by Penumbra at 6:41 PM on November 7, 2021

My opinions, as someone who has a made a weather history intranet website generally using a single site for my own personal use (not a forecast site, not on the internet):

openweathermap's rainfall data is not very good or very intuitive. So you will have to do lots of additional coding to catalogue rainfall accurately.

it doesn't have dew point, so you'll have to calculate that yourself too.

The wind/cloud info is acceptable at best, good enough for my use but not sure it would be accurate enough for lots of uses.

The basic API has no future weather data, just current weather data, so you'll have to build forecasts based on something else.
posted by The_Vegetables at 7:24 AM on November 8, 2021

Yahoo and WeatherUnderground used to be scrape-able to get weather data (and provided future forecast data) but they blocked that (nothing nefarious, just switched to javascript) and now provide it only via paid APIs. Openweathermap's the only one I'm aware of that is free.
posted by The_Vegetables at 7:27 AM on November 8, 2021

« Older What toy did I have?   |   Presbyterian youth go nuts for Blue Rodeo Newer »

You are not logged in, either login or create an account to post comments