Route Queries
The route query allows you to query the weather along your travel route. You need to provide a list of times (see time description) and a list of locations (Polyline or Point list may come in handy), both of the same length. The route query has to include the optional flag &route=true
. Currently available output formats are csv
, json
and xml
.
<xml version="1.0" encoding="UTF-8"> <meteomatics-api-response version="3.0"> <user>meteomatics</user> <dategenerated>2019-05-02T11:45:40Z</dategenerated> <status>OK</status> <data> <location lat="47.4239" lon="9.37286" date="2019-05-02T12:00:00Z"> <parameter name="t_2m:C">15.7</parameter> <parameter name="precip_1h:mm">0.00</parameter> <parameter name="sunshine_duration_1h:min">0.0</parameter> </location> <location lat="47.4994" lon="8.72652" date="2019-05-02T13:00:00Z"> <parameter name="t_2m:C">15.2</parameter> <parameter name="precip_1h:mm">0.00</parameter> <parameter name="sunshine_duration_1h:min">0.0</parameter> </location> <location lat="47.382" lon="8.53066" date="2019-05-02T14:00:00Z"> <parameter name="t_2m:C">12.8</parameter> <parameter name="precip_1h:mm">0.45</parameter> <parameter name="sunshine_duration_1h:min">0.0</parameter> </location> <location lat="46.9499" lon="7.4301" date="2019-05-02T15:00:00Z"> <parameter name="t_2m:C">13.2</parameter> <parameter name="precip_1h:mm">0.00</parameter> <parameter name="sunshine_duration_1h:min">0.2</parameter> </location> </data></meteomatics-api-response>Instead of using coordinates explicitly, you can choose your locations by postal code. In this example the output format is
json
:
https://api.meteomatics.com/2024-12-02T12Z,2024-12-02T13Z,2024-12-02T14Z,2024-12-02T15Z/t_2m:C,precip_1h:mm,sunshine_duration_1h:min/postal_CH9000+postal_CH8400+postal_CH8000+postal_CH3000/json?route=true
{ "version": "3.0", "user": "meteomatics", "dateGenerated": "2019-04-16T12:20:30Z", "status": "OK", "data": [ { "station_id": "postal_CH9000", "date": "2019-04-16T12:00:00Z", "parameters": [ { "parameter": "t_2m:C", "value": 12.3 }, { "parameter": "precip_1h:mm", "value": 0.00 }, { "parameter": "sunshine_duration_1h:min", "value": 0.0 } ] }, { "station_id": "postal_CH8400", "date": "2019-04-16T13:00:00Z", "parameters": [ { "parameter": "t_2m:C", "value": 13.7 }, { "parameter": "precip_1h:mm", "value": 0.00 }, { "parameter": "sunshine_duration_1h:min", "value": 0.0 } ] }, { "station_id": "postal_CH8000", "date": "2019-04-16T14:00:00Z", "parameters": [ { "parameter": "t_2m:C", "value": 12.7 }, { "parameter": "precip_1h:mm", "value": 0.00 }, { "parameter": "sunshine_duration_1h:min", "value": 0.0 } ] }, { "station_id": "postal_CH3000", "date": "2019-04-16T15:00:00Z", "parameters": [ { "parameter": "t_2m:C", "value": 9.2 }, { "parameter": "precip_1h:mm", "value": 0.04 }, { "parameter": "sunshine_duration_1h:min", "value": 0.0 } ] } ] }If you like to work with
csv
, just change the output format:
https://api.meteomatics.com/2024-12-02T12ZPT3H:PT1H/t_2m:C,precip_1h:mm,sunshine_duration_1h:min/postal_CH9000+postal_CH8400+postal_CH8000+postal_CH3000/csv?route=true
station_id;validdate;t_2m:C;precip_1h:mm;sunshine_duration_1h:min postal_CH9000;2019-04-16T12:00:00Z;12.3;0.00;0.0 postal_CH8400;2019-04-16T13:00:00Z;13.7;0.00;0.0 postal_CH8000;2019-04-16T14:00:00Z;12.7;0.00;0.0 postal_CH3000;2019-04-16T15:00:00Z;9.2;0.04;0.0You can also specify the starting and ending point of your route and the increments in-between to get the data along a line https://api.meteomatics.com/2024-12-02T12ZPT1H:PT5M/t_2m:C,precip_10min:mm,wind_speed_10m:ms,elevation:m/47,9_45,7:13/json?route=true or if you like a route consisting of several lines (s. Polylines): https://api.meteomatics.com/2024-12-02T12ZPT1H:PT20M,2024-12-02T13ZPT2H:PT30M/t_2m:C,wind_speed_10m:ms/47,9_45,7:4+45,8:6/xml?route=true
Other Examples
A shipping route example is shown below. It starts in Southhampton, followed by Cherbourg, then Queenstown, and a final stop in New York. Along the route the significant wave height was examined where the red color corresponds to high waves and blue to low wave heights. https://api.meteomatics.com/2024-12-02T14:00:00ZP8D:PT1H/significant_wave_height:m,wind_speed_10m:ms,wind_dir_10m:d/50.8978,-1.4241+50.8943,-1.4072+...+40.6719,-74.0826+40.6637,-74.08964/xml?route=true<?xml version="1.0" encoding="UTF-8"?>
<meteomatics-api-response version="3.0">
<user>meteomatics</user>
<dateGenerated>2019-05-02T11:42:57Z</dateGenerated>
<status>OK</status>
<data>
<location lat="50.8978" lon="-1.4241" date="2019-04-10T14:00:00Z">
<parameter name="significant_wave_height:m">-999</parameter>
<parameter name="wind_speed_10m:ms">4.3</parameter>
<parameter name="wind_dir_10m:d">46.5</parameter>
</location>
<location lat="50.8943" lon="-1.4072" date="2019-04-10T15:00:00Z">
<parameter name="significant_wave_height:m">-999</parameter>
<parameter name="wind_speed_10m:ms">4.0</parameter>
<parameter name="wind_dir_10m:d">47.0</parameter>
</location>
...
<location lat="40.6719" lon="-74.0826" date="2019-04-18T18:00:00Z">
<parameter name="significant_wave_height:m">-999</parameter>
<parameter name="wind_speed_10m:ms">5.9</parameter>
<parameter name="wind_dir_10m:d">134.8</parameter>
</location>
<location lat="40.6637" lon="-74.0896" date="2019-04-18T19:00:00Z">
<parameter name="significant_wave_height:m">-999</parameter>
<parameter name="wind_speed_10m:ms">5.5</parameter>
<parameter name="wind_dir_10m:d">115.2</parameter>
</location>
</data>
</meteomatics-api-response>
This example represents the highway A1 between St. Gallen and Bern. The temperature along the route is shown in the figure where red corresponds to high values and green to low temperatures.
https://api.meteomatics.com/2024-12-02T06:30:00Z,2024-12-02T06:32:10Z,...,2024-12-02T09:32:00Z,2024-12-02T09:35:00Z,2024-12-02T09:43:00Z/t_2m:C,wind_speed_10m:ms/47.43185,9.37355+47.42024,9.33235+...+46.99636,7.50299+46.95326,7.4563/xml?route=true
<?xml version="1.0" encoding="UTF-8"?>
<meteomatics-api-response version="3.0">
<user>meteomatics</user>
<dateGenerated>2019-05-02T11:54:37Z</dateGenerated>
<status>OK</status>
<data>
<location lat="47.4318" lon="9.37355" date="2019-04-25T06:30:00Z">
<parameter name="t_2m:C">13.5</parameter>
<parameter name="wind_speed_10m:ms">4.6</parameter>
</location>
<location lat="47.4202" lon="9.33235" date="2019-04-25T06:32:10Z">
<parameter name="t_2m:C">12.8</parameter>
<parameter name="wind_speed_10m:ms">1.8</parameter>
</location>
...
<location lat="46.9964" lon="7.50299" date="2019-04-25T09:35:00Z">
<parameter name="t_2m:C">13.2</parameter>
<parameter name="wind_speed_10m:ms">4.6</parameter>
</location>
<location lat="46.9533" lon="7.4563" date="2019-04-25T09:43:00Z">
<parameter name="t_2m:C">16.6</parameter>
<parameter name="wind_speed_10m:ms">6.5</parameter>
</location>
</data>
</meteomatics-api-response>