Web API Resource Representations¶
When you request a resource from the Web APIs - for example a feature collection or a time series - the response will include a JSON representation of that resource. Likewise, if you want to add or modify a resource, you need to pass a JSON representation of that resource. This documents the format of various resource representations.
Connections¶
Connection type representation¶
{
"ProviderArguments": [
{
"Mandatory": true,
"Name": "MapSourceConnectionString",
"Type": "System.String, mscorlib"
},
{
"Mandatory": true,
"Name": "MapStyleConnectionString",
"Type": "System.String, mscorlib"
},
{
"Mandatory": true,
"Name": "MapSourceProperties",
"Type": "DHI.Services.Parameters, DHI.Services"
}
],
"ProviderTypes": [
{
"Mandatory": true,
"Name": "MapSourceType",
"Options": [
"DHI.Services.Provider.NetCDF.MapSource, DHI.Services.Provider",
"DHI.Services.Provider.MIKE.Dfs2MapSource, DHI.Services.Provider.MIKE",
"DHI.Services.Provider.MIKE.DfsuMapSource, DHI.Services.Provider.MIKE"
]
},
{
"Mandatory": true,
"Name": "MapStyleRepositoryType",
"Options": [
"DHI.Services.Provider.MapStyleRepository, DHI.Services.Provider",
"DHI.Services.Web.MapStyleRepository, DHI.Services.Web"
]
}
],
"Type": "DHI.Services.Web.MapServiceConnection, DHI.Services.Web",
"Id": "MapServiceConnection"
}
GIS¶
Feature collection representation¶
When querying feature collections, the response is a feature collection representation that is compliant with the GeoJSON specification.
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
-113.210526315789,
49.9736842105263
],
[
-80.5263157894737,
77.4473684210526
],
...
]
]
]
},
"properties": {
"name": "Denmark",
"size": 5000000,
}
},
{
"type": "Feature",
"geometry": {
"type": "MultiPolygon",
"coordinates": [
[
[
[
31.2631578947368,
103.5
],
[
73.8947368421053,
71.7631578947368
],
...
]
]
]
},
"properties": {
"name": "Sweden",
"size": 15000000,
}
}
]
}
{
...
"properties": {
"name": "Sweden",
"size": 15000000,
"associations": [
{
"Id": "/Group1/ts3",
"Type": "timestep"
},
{
"Id": "/Group1/3080_SAVA_DOLINKA_BLEJSKI_MOST_Temperature.dfs0 [weighted]",
"Type": "timestep"
},
{
"Id": "/MyWorkbook",
"Type": "spreadsheet"
}
]
}
...
}
When adding or updating feature collections, the feature collection representation must include a FullName
property representing the feature collection ID. Furthermore, a definition of the feature collection attributes
must be given. The following attribute types are supported:
string
double
int
datetime
bool
Optionally, a Projection
property with a projection string can be given.
{
"FullName": "Cities",
"Projection": "GDA/MGA",
"features": [
{
"geometry": {
"type": "Point",
"coordinates": [
102,
0.5
]
},
"properties": {
"name": "Copenhagen",
"inhabitants": 1000000,
"livable": true
}
}
],
"attributes": [
{
"Type": "string",
"DisplayName": "Name",
"Length": 256,
"Name": "name"
},
{
"Type": "int",
"Name": "inhabitants"
},
{
"Type": "bool",
"DisplayName": "Livable City",
"Name": "livable",
"DefaultValue": false
}
]
}
Geometry collection representation¶
When querying geometry collections, the response is a geometry collection representation that is compliant with the GeoJSON specification.
{
"type": "GeometryCollection",
"geometries": [
{
"type": "MultiPolygon",
"coordinates": [
[
[
[
-113.210526315789,
49.9736842105263
],
[
-80.5263157894737,
77.4473684210526
],
...
]
]
]
},
{
"type": "MultiPolygon",
"coordinates": [
[
[
[
31.2631578947368,
103.5
],
[
73.8947368421053,
71.7631578947368
],
...
]
]
]
}
]
}
Time series¶
Time series representation¶
{
"FullName": "/Group1/SubGroup/530168-23_530168-23_Rainfall Depth",
"Group": "/Group1/SubGroup",
"Id": "7299875c-ee1f-4f20-bb30-066cc267f1bd",
"Metadata": {
"FirstDateTime": "2007-02-15T00:00:00",
"LastDateTime": "2007-02-19T00:00:00",
"ValueType": "Instantaneous",
"IsEquidistant": false,
"Type": "Rainfall Depth",
"Unit": "mm"
},
"Name": "530168-23_530168-23_Rainfall Depth"
}
Time series values representation¶
The time series values representation is a JSON array of data points. A data point is itself an array with a datetime and a value. Furthermore, depending on the underlying type of time series provider, a data point might comprise additional annotations such as a quality flag or a time of forecast.
[
[
"2007-02-18T22:15:00",
0.22908926
],
[
"2007-02-18T22:20:00",
0.229103819,
1
],
[
"2007-02-18T22:25:00",
0.229120463
],
...
]
Multiple time series values representation¶
The representation of multiple time series values is a JSON object with one name/value pair per time series. The name is the full-name of the time series, and the value is the array of data points as described above.
{
"ts1": [
[
"2007-02-18T22:15:00",
0.22908926
],
[
"2007-02-18T22:20:00",
0.229103819,
1
],
...
],
"ts2": [
[
"2007-02-18T22:15:00",
1.22908926
],
[
"2007-02-18T22:20:00",
1.229103819
],
...
]
}
Vector time series values representation¶
The vector time series values representation is a JSON array of data points. A data point is itself an array with a datetime and a vector. Furthermore, depending on the underlying type of time series provider, a data point might comprise additional annotations such as a quality flag or a time of forecast.
[
[
"1993-12-02T00:00:00",
{
"X": 9.293999671936035,
"Y": 9.293999671936035,
"Size": 13.143700384743036,
"Direction": 45
}
],
[
"1993-12-02T00:30:00",
{
"X": 10.065999984741211,
"Y": 10.065999984741211,
"Size": 14.235473697268387,
"Direction": 45
}
],
...
]
Multiple vector time series values representation¶
The representation of multiple vector time series values is a JSON object with one name/value pair per vector time series. The name is a combination of the full-names of the two X- and Y-component time series, and the value is the array of data points as described above.
{
"/Forcings/WindSpeed_X; /Forcings/WindSpeed_Y": [
[
"1993-12-02T00:00:00",
{
"X": 9.293999671936035,
"Y": 9.293999671936035,
"Size": 13.143700384743036,
"Direction": 45
}
],
[
"1993-12-02T00:30:00",
{
"X": 10.065999984741211,
"Y": 10.065999984741211,
"Size": 14.235473697268387,
"Direction": 45
}
]
],
"CurrentSpeed_X; CurrentSpeed_Y": [
[
"1993-12-02T00:00:00",
{
"X": 9.293999671936035,
"Y": 9.293999671936035,
"Size": 13.143700384743036,
"Direction": 45
}
],
[
"1993-12-02T00:30:00",
{
"X": 10.065999984741211,
"Y": 10.065999984741211,
"Size": 14.235473697268387,
"Direction": 45
}
]
],
...
}
Tables¶
Table representation¶
{
"Columns": [
{
"Name": "TimeOfMeasurement",
"DataType": "System.DateTime, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"IsKey": false
},
{
"Name": "WaterLevel",
"DataType": "System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
"IsKey": false
}
],
"Id": "WaterLevels"
}