GetFeature Request
The GetFeature
-Request fetches data. A basic GetFeature
-Request according to the WFS 1.0.0 standard is constructed as follows:
https://api-mm.ncm.gov.sa/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=<feature_type>&BBOX=<min_lon,min_lat,max_lon,max_lat>&MAXFEATURES=<max_features>
The two optional standard WFS arguments BBOX
and MAXFEATURES
limit the amount of features that will appear in the XML file. If a bounding box (BBOX
) is specified, the XML response will contain only features located within the specified area. The MAXFEATURES
parameter caps the amount of delivered features to the specified number. Their use (especially of the bounding box) is recommended as some feature lists are rather expansive, and therefore the GetFeature response will be a large XML file.
Parameter | Description | Example |
---|---|---|
BBOX | A bounding box specified by maximal and minimal latitude and longitude formatted according to BBOX=<min_lon,min_lat,max_lon,max_lat> (please note the order). The response will only contain features that are located within this area. If left unspecified, all available features will be returned. | BBOX=5.8,47.9,10.7,45.7 |
MAXFEATURES | An unsigned integer specifying the maximal amount of features contained in the XML response, where it is not specified which features are to be omitted. Unbounded if left unspecified. | MAXFEATURES=100 |
TIME | A single point in time (UTC) as specified in the section Date/Time Description. TIME always refers to validdatetime. The response depends on the feature type, see the examples below. | TIME=2018-04-12T12:45Z |
The main WFS feature type is described in more detail below.
Station Data
Currently, only one station feature type is available: stations_mix-obs
, which contains most of our combined observational data.
In order to fetch data from these weather stations, you'll need to use our custom parameter PARAMETERS
:
Parameter | Description | Example |
---|---|---|
PARAMETERS | The parameters that you wish to query formatted as a comma-separated list as specified here. The DescribeFeatureType contains all the relevant parameters provided by the station type. For technical reasons the name of the XML node will have the colons (: ) replaced with an underscore (_ ), e.g. t_2m:C will end up as t_2m_C . For WFS purposes only you may also use this format in the queries. | t_2m:C,dew_point_2m:C or t_2m_C,dew_point_2m_C |
Together with the parameters already mentioned above, this allows to query station data for the purposes listed in the following table:
Goal | Mandatory parameters | Effect of TIME on the response | Example query |
---|---|---|---|
Station List | TYPENAME : stations_mix-obs for observational data. | Returns the entire list of stations if unspecified, otherwise only stations that have data available at that time. | https://api-mm.ncm.gov.sa/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=stations_mix-obs&TIME=2018-04-12T13:00Z&BBOX=5.77,45.74,10.65,47.89 |
Station Data | TYPENAME as above, PARAMETERS from the list of possible parameters provided by the stations (c.f. the DescribeFeatureType response). | Time stamp of the queried data. If not supplied, we use the current time minus one hour and floor that to the last full hour, meaning that the data is 1-2 hours old. | https://api-mm.ncm.gov.sa/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=stations_mix-obs&TIME=2018-04-12T13:00Z&PARAMETERS=t_2m:C,precip_1h:mm&BBOX=5.77,45.74,10.65,47.89 |
Please be aware that not all weather stations can provide all the parameters that are advertised by the DescribeFeatureType XML. Unavailable parameters will have no node in the XML response and GIS software usually leaves the corresponding space in the attribute table empty or indicates the absence by something like NULL
.
It is also possible filtering observation data by importance of the location using the optional parameter level_of_detail
:
Optional parameter | Description | Example |
---|---|---|
level_of_detail | To all WFS queries, you can append a level_of_detail filter that will get either all station data in cities or capitals in a bounding box. | capitals or cities |
The following example gives you all the stations that provided a value for the given bounding box:
https://api-mm.ncm.gov.sa/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&TYPENAME=stations_mix-obs&TIME=2025-07-17T00Z&BBOX=0,40,10,50&level_of_detail=capitals