Weather sites demo

In this OpenLayers demo, sites are displayed on a map to show different weather information such as the temperature, humidity, etc.

Sites are stored in a PostGIS database and served by TinyOWS. They are fetched using the WFS protocol, but are returned in GeoJSON instead of GML for a much lighter result.

Each site contains weather information about its specific location. They are displayed on the map using a vector layer and rules that change according to the information currently being displayed. This is controlled by a custom switcher on the right. The points are drawn following a specific range of color for each information type. The value is also drawn as a label. You can click on a feature to display its full information.

Some technical details

The javascript and css source files were mi were minimized using the YUI Compressor tool .

Vector geometries and labels are not drawn on the same root container by the renderer. In order to avoid labels from bottom features to overlap features that are on top, the labels and geometries were forced to use the same container.

In order to avoid having too many features displayed on the map on small scales that would slow it down, a specific field was added to the dataset. The value represent the minimum zoom level a record must have to be fetch. So, a custom filter containing the current zoom level is added to the WFS requests sent. That's why you only see just a small portion of the data on small scales and you get more as you zoom in.


Alexandre Dubé

Mapgears Inc.

info@mapgears.com