URL | Parameters | Response Properties | Examples | Query1 | Response1 | Query2 | Response2
The weather method takes any valid entity's guid and returns the current, real time, weather conditions for that entity's location in the continental United States (and soon, most of the world). You can find specific conditions for a point entity, or average conditions across a boundary-defined entity such as a city. For boundary entities, weather interpolates conditions between weather stations rather than just return information from the closest station.
weather uses the WeatherBug backend for its data. Thus, you must abide by the WeatherBug API Terms of Use if your application uses this method.
Results are a JSON array of properties and their numerical values, save for one string timestamp value. By default, values are in imperial/English units such as Fahrenheit degrees and inches. You can use a request parameter to change all units to metric.
An invalid guid argument results in a HTTP 404 error response. If the weather service is down, or weather data is not available for the area, all results have null values. If there is a problem with our servers, you may get the response {"error": "you've encountered an internal error :-( please contact api@townme.com if it persists"}
http://api.geoapi.com/v1/e/<guid>/view/weather
http://api.geoapi.com/v1/e/<guid>/view/weather:units=metric
Parameters [Top]
- guid:
- Required.
- Any valid entity's guid.
- Format: String.
- units:
- Optional.
- Specifies whether results are given in imperial (English) or metric units. By default, results are in imperial units. Use metric to change to metric units, You can also use imperial to make it clear that you want to return values in imperial units.
- Format: String. Unlike other parameters, you append units to the method name with a colon, with its argument value appended to it after an equal sign. For example, .../weather:units=metric
- apikey:
- Required.
- Your application's GeoAPI key.
- Format: String.
- pretty:
- Optional.
- Enables easier to read prettified JSON in result.
- Format: Set equal to 1 to enable prettification.
- jsoncallback:
- Optional.
- Return response in JSONP format. JQuery has nice support for JSONP callbacks.
- Format: JSON prefix string.
Response Properties [Top]
All values are floating point numbers, unless otherwise specified. Temperatures may be positive or negative numbers. Value units depend on the category, and default to imperial (English) units unless you append the :units=metric parameter to the weather view name in the request. null is returned for any unavailable value.
For point entities, values are interpolated based on geography and nearby weather stations. For region entities, like a neighborhood or city, most values are a numerical average over the region. However, since radar data is typically spotty, for radar values the maximum value is returned.
WARNING: We may add more weather properties later on. When processing weather method response data, make sure your code safely ignores any unknown to it properties and their values.
http://api.geoapi.com/v1/e/san-francisco-zoo-san-francisco-ca/view/weather?apikey=demo&pretty=1
{
"query": {
"type": "entity-view",
"params": {
"guid": "san-francisco-zoo-san-francisco-ca",
"view": "weather"
}
},
"result": [
{
"UpdateTime": "2009-12-04T03:00:24Z",
"DailyRain": 0,
"Temperature": 47,
"DewPoint": 39,
"Radar": 0,
"HeatIndex": null,
"Humidity": 82.8,
"Pressure": 30.2,
"WindSpeed": 2,
"WindChill": null
}
]
}
http://api.geoapi.com/v1/e/san-francisco-ca/view/weather?apikey=demo&pretty=1
{
"query": {
"type": "entity-view",
"params": {
"guid": "san-francisco-ca",
"view": "weather:units=metric"
}
},
"result": [
{
"UpdateTime": "2009-12-04T03:00:24Z",
"DailyRain": 0,
"Temperature": 8.3,
"DewPoint": 3.9,
"Radar": 0,
"HeatIndex": null,
"Humidity": 81.7,
"Pressure": 1022.3,
"WindSpeed": 1.2,
"WindChill": null
}
]
}