Table of Contents
Weather forecast is more than just small talk—they influence how we plan events, commute, and even prioritize our health. In today’s fast-paced, interconnected world, having access to accurate and real-time weather information can make a huge difference.
For example:
- If it’s snowing or raining, you might change your outdoor activity plans.
- High fine dust (PM2.5) levels? You may avoid jogging or postpone a picnic.
That’s why integrating weather forecast into your applications or personal tools can be a smart move—especially when using Python and weather APIs.
Step 1: Get Geographic Coordinates Using Google Maps
Before fetching weather data, you need to identify the location’s latitude and longitude.
How to find coordinates:
- Go to Google Maps.
- Right-click on the desired location.
- Select “What’s here?”
- Coordinates like this will appear:
lat = 21.3363571
,lon = -158.0282134

Tip:
You can also extract coordinates from the URL when clicking on a map location:

https://www.google.com/maps/place/.../@21.3363571,-158.0282134,17z
Step 2: Use OpenWeatherMap API
Get Started
Visit OpenWeatherMap and:

- Create an account
- Get your API key from the dashboard

Step 3: Make a Weather Forecast API Request

Use the following API endpoint:
https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={API key}
Example Python Code
import requests
key = '{Input Your Key}'
lat = 21.3363571
lon = -158.0282134
def get_current_weather(key, lon, lat):
url = f"https://api.openweathermap.org/data/2.5/weather?lat={lat}&lon={lon}&appid={key}"
response = requests.get(url)
return response.json()
if __name__ == "__main__":
weather = get_current_weather(key, lon, lat)
print(weather)
Example Output (JSON)
{
"coord": {"lon": -158.0282, "lat": 21.3364},
"weather": [{"main": "Drizzle", "description": "light intensity drizzle"}],
"main": {
"temp": 301.51,
"feels_like": 304.38,
"humidity": 69,
"pressure": 1017
},
"wind": {"speed": 5.66, "deg": 50},
"clouds": {"all": 20},
"name": "‘Ewa Gentry",
"cod": 200
}
Understanding Key Weather Metrics
Temperature
temp
: Current temperature in Kelvin (convert to Celsius withtemp - 273.15
)feels_like
: How it actually feels, factoring in wind and humidity
Humidity
- A percentage value; 70%+ often feels muggy
Wind
speed
: Wind speed in m/sdeg
: Wind direction in degrees
Barometric Pressure
pressure
: Measured in hPa (hectopascals)- High pressure: Stable, clear skies
- Low pressure: Rain, storms, or changing conditions
Why Barometric Pressure Matters
Though not as familiar as temperature, barometric pressure is crucial for predicting weather:
Pressure Type | Common Weather |
---|---|
High | Clear, dry |
Low | Rainy, stormy |
For those building event scheduling apps, knowing pressure trends helps prepare users for potential delays or cancellations.
Use Cases for Weather Integration
- Mobile apps: Show users whether to bring an umbrella
- Calendar services: Automatically warn about poor weather for outdoor plans
- Health trackers: Suggest avoiding activity during poor air quality
- LLM chatbots: Use current conditions to recommend activities
Optional: Paid API for More Data
The free plan supports:
- Current weather
- 3-hour forecasts
- Basic air quality
Paid plans unlock:
- Historical weather data
- Advanced pollution data
- Minute-by-minute forecasts
If you’re building something professional, it’s worth investing in additional insights.
Conclusion
With just a few lines of Python and OpenWeatherMap’s API, you can access live weather data for any region in the world. It’s accurate, flexible, and easy to integrate—perfect for enhancing your personal tools or professional applications.
Start small with current weather, and expand into forecasting, alerts, or even combining weather trends with AI for smarter decisions.