It’s a good question. Initially, the URL was lat/long values, and then I did try place names. I ended up with the short code approach to minimise API calls to downstream services.
The short code in the URL is generated at search time, and maps to a location name, lat/long, altitude etc. within a table. It’s generated off of the location name, so two people searching for the same place get the same short code.
The short code enables a forecast lookup to be a SQLite DB read, followed by a single API call for the forecast.
A more descriptive URL would have required two sequential calls - one to figure out the lat/long and/or place name, and another for the forecast. This wasn’t a huge speed problem, but I struggled to find geocoding APIs with generous free tiers or reasonable low volume pricing. It would have also made the forecast at a given URL somewhat non-deterministic, as the geocoding API could change its output or preferred result over time.
Short codes quite possibly wasn’t the right solution. It’s definitely something I’ll think more about. Thank you!
How about adding the location information as a suffix to the short code, e.g. `/forecast//united-kingdom/yorkshire/york`? The latter part of the URL is of not use to the site, but is useful for the user.
I don’t get that reason, couldn’t you just use the location name as a field in the database just like you use the short code right now? Where’s the additional API call on lookup coming from?
Situation a:
Someone searches for location XYZ.
The geocoding API returns lat and Lon and canonical name ABC.
You save that and the slugified name abc in your DB.
(If the API doesn’t return a name, you can use XYZ instead of ABC).
You return slug abc to the user.
Situation b:
Someone requests weather for location at slug abc. You look in your DB, ask the weather API for the weather at lat/lon and return that to the user.
Situation c:
Someone searches for a place that happens to already exist in the DB.
You geocode the search term and get a lat/lon pair that’s already in the DB so you return the saved slug.
How is that different than using a shortcode? In which situation are you doing a geocoding API request you don’t need to do with the current system?
Perhaps similar to a command line utility? Arguments could be passed as URL or query parameters. And perhaps a /help route can return the supported arguments.
Use-cases will vary widely. For example if I used Brolly for sailing, I'd want wind speed in kts and wind direction as well as dew point, and I'd want a recent timeseries of air pressure to give an idea of the synoptic-scale situation.
Of course these may be far outside your original use-cases. I think when people get a hold of Brolly, they're going to love it immediately, and there will be a flood of feature requests. If that happens, might be good to design the layers needed for diverse customization.
Thanks! I’ve also got a long list of additional data I’d like to see, such as sunrise / sunset times and astrological activity like upcoming meteor showers etc.
I’m starting to think about dedicated sub pages that cover these use cases, with a single section on the main page that links into it. A sailing based page could definitely work here!
I think the most useful data to add is the 60-min precipitation forecast.
Unfortunately open-meteo doesn't offer this.
So https://weather-sense.leftium.com uses the 60-min forecast from OpenWeather. But you have to specifically request it because the free-tier quota is not as generous. (I think Apple's WeatherKit may also offer this data, but I was unable to get WeatherKit to work at all)
---
After that, the wind is important for people who like outdoor activities. For example, Kayak rentals are paused when it gets too windy. On the other hand, kite boarders like it when it's windier.
> A sailing based page could definitely work here!
Even within a niche category like sailing there's a wide range of user needs, for example reporting temperatures in C vs F, or pressure in hPa vs inHg.
Coming from another angle, would it be possible to URL-encode user preferences, so that everyone gets their own bespoke Brolly forecast? There can still be prefab pages for common situations, so that informal and power users are all delighted.
That’s frustrating, thank you for the feedback. I’ll take a look at improving the search and potentially switching out the API provider. I currently use open-meteo as I was already using it for the weather forecast (it has a great weather API), and it made sense at the time to keep with a single provider.
I tried searching for "Austin, Texas, United States", "Austin, Texas" and just "Texas" and didn't find very much - not sure if I'm missing how they're indexed, but I'd expect at least one of those to find it!
Similarly, "Orlando" returns a bunch of results but "Orlando FL" returns none.
It would also be nice if it suggested results before you finished typing. For example, if I've typed out "orl", then Orlando should be the top suggested result.
I agree, it’s definitely something to work on as it takes up a considerable amount of vertical space.
I found the precipitation chart challenging as you need to present both the forecasted precipitation, and the potential likelihood of the precipitation occurring. Something I’ve considered is using a horizontal graph with different shades of grey through black in each bar to represent the probability, but it would somewhat reduce accessibility.
I think you may be able just drop the precipitation chance. While the precipitation chance is interesting, I tend to not experience any actual rain even if the predicted chance is 90+ percent. Even if there is rain, usually the amount is not worth bringing an umbrella for.
My https://weather-sense.leftium.com also uses open-meteo for weather data. And I've been comparing how precipitation amount/chance forecasts compare to real life experience.
Look at how vastly different the precipitation chance and amount were for Seoul the past few days: https://weather-sense.leftium.com/?n=seoul According to the chance, it was raining non-stop 48+ hours. The precipitation bars give a much better idea when actual precipitation occurred.
It uses open-meteo.com. Their forecast API returns data from around 30 different models depending on location, and typically uses Met Office data in the UK. I don’t force to only Met Office though, as they don’t give data for everything shown (such as the pollen count per species).
Open-meteo has a very generous free tier, and reasonable pricing. It also lets you fetch weather from previous days, which I’ve included so you can see if it’s relatively hotter/colder etc. than yesterday.
Sorry about this, and thank you for the heads up. The site runs as a PocketBase instance on a small 512mb DigitalOcean droplet in their London DC, and is getting more load than usual at the moment.
I’ll take a look though at whether there’s anything causing fundamental slowness in the cache read / page rendering pipeline.
Great suggestion, thank you. I’ll definitely keep that in mind as an improvement. There’s been some other feedback that it’d be good if there was a ‘true’ plain text only mode, and this ties in well.