In the previous article we discussed how How to integrate free marine and terrestrial weather forecasts into ArcGis .
In this article we will discuss how to integrate these data into a QGis project . We will use 8- day marine forecast data. These data is provided by the companies NASCA and ACTIMAR , via their products enav-forecast . In addition to the software that uses these forecasts and allows for their consultation and analysis ( enav-viewer , enav-forecast , enav-forecast for iPhone , enav -Pilot ), these companies also provide access to data via a WFS connection.
What data is available?
Regarding the data type, you access the 8- day forecasts, every 3 hours, for the following parameters:
- height (in m) , direction (in °) and wave period (in s)
- crossed sea (wave direction in ° , direction of the swell in °)
- speed (in knots ) and direction (in °) of the average wind
- speed (in knots ) of wind gusts
- speed (in knots ) and direction (in °) of the surface current
- temperature (in ° C) of the sea surface
- temperature (in ° C) of the air
- rainfall (in mm)
What data mesh?
The mesh of free forecasts is 0.5 °. Other meshes are available but subject to subscription (see subscriptions).
The forecasts cover the whole world.
Frequency of update
The forecasts are updated four times a day.
Establish the WFS connection
To establish a WFS connection click the button “Add a WFS layer”, then click the button “New” to create the connection parameters.
As for the name type a rather specific name: NASCA Marine Weather, for example.
For the URL, enter the following string:
Click OK to close the configuration.
The connection now appears in the list of available connections.
Before you log in
Open a project with the WGS84 Geographic SCR. Display a base map that allows you to zoom in on the area of interest. When you connect to the WFS server, QGis will send a query with the coordinates of the four corners of your current display. The server will send the predictions found inside this rectangle to your machine.
If you are in projection mode and not in geographical, neither QGis nor the server will make a transformation of the coordinates. Frequently, you will have no result in return not even an error message.
Therefore it has to be verified that what you are going to transmit are coordinates in degrees of latitude and longitude. For that, simply, look at the status bar at the bottom of the QGis window: you have a field called “contact information “. The values in this field must be between -180 and 180. If this is the case, you are working with geographic coordinates.
If you are in geographical coordinates but do not zoom in on the area of interest, you may have an area too big for the query. In addition to being time consuming, WFS servers still have a limit on the number of records. If it is reached, the server sends the found records and then suddenly stops. You will not have a warning message; and the data will be cut down.
How to connect to the WFS server
A new connection now appears in the list of proposed connections when you click the button “Add a WFS layer”. Click the “Log in”.
You will only use the layer: view_meteo99
Click this line to select it. Uncheck the box “Cache feature”.
Click “Add”.
Displaying the forecast data
After a few seconds, the new layer is added to the QGis map window.
Each forecast “point” is, actually, a collection of 66 points. To be able to view the forecasts for a given time, you will have to make a selection of the data set of each point. Performing this task as requests to the server is too complicated and it is not worth. The most efficient method is to display all the data in QGis and create a new layer on your workstation.
You can do this directly by clicking the legend of the layer and selecting “Save as …” But do not rush, there are other little things to fix, and we’ll do it all at once.
WFS connections with QGis have a small flaw: according to the first value found for an attribute field of the table, it defines the data type. Often we are left with numeric fields in the original table of the server which are interpreted as text strings by QGis , locally. With marine forecasts, the problem does not arise for the force and speed values, which are always values to the decimal point. On the other hand, for direction values, which are integers, the problem arises.
You will have direction values as a text string. Even if, for a simple display it does not change much, when displaying oriented arrows (currents, waves, wind) it is impossible to request a rotation of the symbol with a text field . It is imperative that the direction field be numeric.
To solve this problem, you must create a new numeric field and use the field calculator to calculate the text strings values for the three direction fields (wave, wind, current).
Tedious work. So, we have to find a less tedious solution. We have built a treatment model with the QGis “Graphic modeller”. This is a small file, which you can download in here .
Unzip the file into a directory of your choice.
Open the Chart Modeller:
In the Modeller window, click the first button to open the downloaded template. Point to the meteoNasca.model file.
The model is loading.
To execute it, click the right button “Launch the model”.
Check that the input file is the layer “view_meteo99”.
Browse the directories to define the location and name of the shape file that will be created on your computer. Select “Save to file”
Click on Run
The new layer is loaded in the map window. You can now delete the WFS layer, it avoids having to load each time you change the grip of the view.
Symbology of the forecast data
For simple data (temperature, rainfall …) the only thing to remember is that you have 66 points superimposed on each forecast location. You must go through a “subset query “ so as to show only one step at a time :
Layer properties -> ” General »-> Subset (click on query builder)
You have two attributes, the first for today’s date, and the second for the hour. WARNING! The hour is GMT not in local hour.
Before applying the symbologies, do not forget to define the selection request. Otherwise you will end up with a stack of symbols on each point.
For complex data (wind, waves, current) you have at least two associated values: direction and strength. The classic way to display this type of data is to use an arrow oriented in the direction of the phenomenon and to assign it either a size or a different colour depending on the force.
First thing to know: How is the direction of the phenomenon coded?
All directions present in the attributes of the table indicate the direction from which the phenomenon originates (the direction from which it comes).
To orient the arrows, it is necessary to apply a rotation to the symbol. If you choose a symbol “arrow up” and you enter as rotation field, only, the name of the direction field, your arrows will indicate the opposite direction! In this case, use an expression, for rotation, of type [field direction] – 180.
We have prepared three layer files with standard symbology that should do the trick. You can download them in here .
In the compressed file, you have three Qgis layers style files (wind, current and waves) and a folder with the symbols used for the wind on the weather charts (barbules).
The first three can be extracted in the directory of your choice. On the other hand, the file “barbs” must be copied in the Gis / apps / qgis / svg installation directory . If not, the symbols will not be accessible for style files.
The symbology for the wind is as follows:
The symbols used are standard barbules, with increments of 5 in 5 knots up to 65 knots.
The rotation field is already corrected to have the right orientation of the barbules.
The symbology for the current is as follows:
The symbols used are arrows, with increments of 1 knot. The size of the arrows increases according to the speed. Up to 3 knots are in blue, between 3 and 5 are in orange and from 6 knots in red.
The rotation field is corrected by 180 ° to obtain the right orientation of the arrows.
Remember to add in the selection request, besides date and time, a filter on the direction and speed so as not to display the null values on the ground ( CourantVal <> 0 ANDICurDir <> 0 ).
The symbology for the waves is as follows:
The symbols used are arrows, with increments of 1 meter. Heights of up to 3 meters are green, between 4 and 7 are yellow and from 7 knots are orange-red.
The rotation field is corrected by 180 ° to have the right orientation of the arrows.
Remember to add in the selection request, besides the date and time, a filter on the direction and speed so as not to display the null values on the ground ( HsVal <> 0 AND IHsDir <> 0).
The labels indicate the significant height of the waves in meters, and the wave period in seconds.
If you have questions, feel free to leave a comment!