Skip to main content

Weather and Rainfall

Current Weather by Location​

Location: src/screens/WeatherLocationScreen.tsx

Fetches live weather conditions (temperature, humidity, wind speed, pressure, and weather description) for any tapped coordinate or current GPS location using SSMap.getWeather().

// Fetch current weather by coordinates [longitude, latitude] or (lat, lng)
const weather = await SSMap.getWeather(latitude, longitude);

console.log(`Temperature: ${weather.temp_c}°C`);
console.log(`Condition: ${weather.weather_condition}`);
console.log(`Humidity: ${weather.relative_humidity_percent}%`);
console.log(`Wind: ${weather.wind_kph} km/h`);

City Weather Forecast (7-Day Forecast)​

Location: src/screens/WeatherCityForecastScreen.tsx

Fetches comprehensive 7-day weather forecasts across cities with SSMap.getCityWeatherForecast(). Badges are dynamically rendered on the map with viewport virtualization and collision prevention.

// Fetch cities weather forecasts
const forecasts = await SSMap.getCityWeatherForecast();

// Each forecast item contains today's and 7-day projections:
forecasts.forEach(city => {
console.log(`Station: ${city.Station_Name}`);
console.log(`Today Max: ${city.Today_Max_temp}°C | Min: ${city.Today_Min_temp}°C`);
console.log(`Today Forecast: ${city.Todays_Forecast}`);
console.log(`Coordinates: [${city.Longitude}, ${city.Latitude}]`);
});

Statewise Rainfall​

Location: src/screens/WeatherStatewiseRainfallScreen.tsx

Retrieves daily, weekly, cumulative, and monthly rainfall statistics across 41 Indian States and Union Territories with SSMap.getStatewiseRainfall().

// Fetch statewise rainfall statistics
const rainfallData = await SSMap.getStatewiseRainfall();

rainfallData.forEach(stateItem => {
console.log(`State: ${stateItem.State}`);
console.log(`Daily Actual: ${stateItem['Daily Actual']} mm | Normal: ${stateItem['Daily Normal']} mm`);
console.log(`Daily Departure: ${stateItem['Daily Departure Per']} (Category: ${stateItem['Daily Category']})`);
console.log(`Weekly Actual: ${stateItem['Weekly Actual']} mm`);
console.log(`Cumulative Actual: ${stateItem['Cumulative Actual']} mm`);
});

See also: React Native Map SDK overview.