Met Office Weather Maps PHP API

For those who want to add detailed weather maps of the UK to their websites an excellent option is to use the Met Office’sDataPoint web service API. Among many other features the API makes available several different types of observation and forecast time series weather maps as detailed images.

However, DataPoint still leaves users with a lot of work to do if they want to utilise the maps on their websites. For example the DataPoint API only provides the map images as simple layers with no underlying map of the UK. This gives users the flexibility of adding their own UK maps but creates one of many common problems that all DataPoint users have to solve individually.

To address this and other website integration issues I’ve made the met-office-weather-maps PHP API available on GitHub under the MIT License. It’s primary use case is to make it easier to incorporate the latest Met Office weather maps into a web site while not requiring users to directly engage with the Datapoint API.

It’s functionality includes:

Wrapping the complexity of underlying JSON web service calls by exposing one simple PHP class for each available map type.

Adding UK timestamps to map images where they are not already present.

Operating caching to allow maps to be requested on a regular schedule. This ensures that the latest maps are fetched without making excessive calls to DataPoint which may breach their fair use agreement.

The met-office-weather-maps API supports all of the DataPoint map types:

Infrared satellite

Lightning strikes

Precipitation forecast

Pressure forecast

Rainfall radar

Surface pressure charts

Temperature forecast

Total cloud cover forecast

Total cloud cover and precipitation forecast

Visible satellite

See the met-office-weather-maps Git Hub project page for details of its requirements, installation and API documentation.