Skip to content

Commit 6a8fa69

Browse files
committed
Revert hotfix
1 parent 6748fc9 commit 6a8fa69

File tree

6 files changed

+423
-411
lines changed

6 files changed

+423
-411
lines changed

doc/advanced-topics.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ curl http://${KEYSTONE_HOST}/v3/OS-TRUST/trusts \
4646
Apart from the generation of the trust, the use of secured Context Brokers should be transparent to the user of the IoT
4747
Agent.
4848

49-
### GeoJSON support (this only applies for NGSI-LD, not for NGSIv1 and NGSIv2)
49+
### GeoJSON support
5050

5151
The defined `type` of any GeoJSON attribute can be any set to any of the standard NGSI-v2 GeoJSON types - (e.g.
5252
`geo:json`, `geo:point`). NGSI-LD formats such as `GeoProperty`, `Point` and `LineString` are also accepted `type`
@@ -69,17 +69,19 @@ values. If the latitude and longitude are received as separate measures, the
6969
}
7070
```
7171

72-
For `attributes` and `static_attributes` which need to be formatted as GeoJSON values, three separate input formats are
73-
accepted. Provided the `type` is provisioned correctly, the `value` may be defined using any of the following formats:
7472

75-
- a comma delimited string
73+
For `attributes` and `static_attributes` which need to be formatted as GeoJSON values, three separate input
74+
formats are accepted. Provided the `type` is provisioned correctly, the `value` may be defined using any of
75+
the following formats:
76+
77+
- a comma delimited string
7678

7779
```json
7880
{
79-
"name": "location",
80-
"value": "23, 12.5"
81+
"name": "location",
82+
"value": "23, 12.5"
8183
}
82-
```
84+
````
8385

8486
- an array of numbers
8587

@@ -183,12 +185,11 @@ Other unrecognised `type` attributes will be passed as NGSI-LD data using the fo
183185
}
184186
```
185187

188+
186189
### NGSI-LD Linked Data support
187190

188-
`static_attributes` may be supplied with an additional `link` data element when provisioning an IoT Agent to ensure that
189-
active attributes from the provisioned IoT Device may be maintained in parallel with a linked data entity . Take for
190-
example a temperature gauge placed within a building. The **Device** data model literally represents the IoT device
191-
itself, but the `temperature` attribute also needs to be shared with the **Building** entity
191+
`static_attributes` may be supplied with an additional `link` data element when provisioning an IoT Agent to ensure that active attributes from the provisioned IoT Device may be maintained in parallel with a linked data entity . Take for example a temperature gauge placed within a building.
192+
The **Device** data model literally represents the IoT device itself, but the `temperature` attribute also needs to be shared with the **Building** entity
192193

193194
A `link` between them can be provisioned as shown:
194195

@@ -222,8 +223,7 @@ e.g.:
222223
}
223224
```
224225

225-
Whenever a `temperature` measure is received **Device** is updated, and entity `urn:ngsi-ld:Building:001` is also
226-
updated as shown:
226+
Whenever a `temperature` measure is received **Device** is updated, and entity `urn:ngsi-ld:Building:001` is also updated as shown:
227227

228228
```json
229229
"temperature": {
@@ -292,7 +292,7 @@ The library provides some plugins out of the box, in the `dataPlugins` collectio
292292
use the `addQueryMiddleware` and `addUpdateMiddleware` functions with the selected plugin, as in the example:
293293

294294
```javascript
295-
var iotaLib = require('iotagent-node-lib');
295+
var iotaLib = require("iotagent-node-lib");
296296

297297
iotaLib.addUpdateMiddleware(iotaLib.dataPlugins.compressTimestamp.update);
298298
iotaLib.addQueryMiddleware(iotaLib.dataPlugins.compressTimestamp.query);

lib/services/ngsi/entities-NGSI-v2.js

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -55,39 +55,37 @@ function formatGeoAttrs(attr) {
5555
switch (attr.type.toLowerCase()) {
5656
// GeoProperties
5757
case 'geo:json':
58-
// FIXME: #1012
59-
// case 'geoproperty':
60-
// case 'point':
61-
// case 'geo:point':
58+
case 'geoproperty':
59+
case 'point':
60+
case 'geo:point':
6261
obj.type = 'geo:json';
6362
obj.value = NGSIUtils.getLngLats('Point', attr.value);
6463
break;
65-
// FIXME: #1012
66-
// case 'linestring':
67-
// case 'geo:linestring':
68-
// obj.type = 'geo:json';
69-
// obj.value = NGSIUtils.getLngLats('LineString', attr.value);
70-
// break;
71-
// case 'polygon':
72-
// case 'geo:polygon':
73-
// obj.type = 'geo:json';
74-
// obj.value = NGSIUtils.getLngLats('Polygon', attr.value);
75-
// break;
76-
// case 'multipoint':
77-
// case 'geo:multipoint':
78-
// obj.type = 'geo:json';
79-
// obj.value = NGSIUtils.getLngLats('MultiPoint', attr.value);
80-
// break;
81-
// case 'multilinestring':
82-
// case 'geo:multilinestring':
83-
// obj.type = 'geo:json';
84-
// obj.value = NGSIUtils.getLngLats('MultiLineString', attr.value);
85-
// break;
86-
// case 'multipolygon':
87-
// case 'geo:multipolygon':
88-
// obj.type = 'geo:json';
89-
// obj.value = NGSIUtils.getLngLats('MultiPolygon', attr.value);
90-
// break;
64+
case 'linestring':
65+
case 'geo:linestring':
66+
obj.type = 'geo:json';
67+
obj.value = NGSIUtils.getLngLats('LineString', attr.value);
68+
break;
69+
case 'polygon':
70+
case 'geo:polygon':
71+
obj.type = 'geo:json';
72+
obj.value = NGSIUtils.getLngLats('Polygon', attr.value);
73+
break;
74+
case 'multipoint':
75+
case 'geo:multipoint':
76+
obj.type = 'geo:json';
77+
obj.value = NGSIUtils.getLngLats('MultiPoint', attr.value);
78+
break;
79+
case 'multilinestring':
80+
case 'geo:multilinestring':
81+
obj.type = 'geo:json';
82+
obj.value = NGSIUtils.getLngLats('MultiLineString', attr.value);
83+
break;
84+
case 'multipolygon':
85+
case 'geo:multipolygon':
86+
obj.type = 'geo:json';
87+
obj.value = NGSIUtils.getLngLats('MultiPolygon', attr.value);
88+
break;
9189
}
9290
}
9391
return obj;

test/unit/ngsiv2/examples/contextRequests/createBidirectionalDevice.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
"id": "TheFirstLight",
33
"type": "TheLightType",
44
"location": {
5-
"type": "geo:point",
6-
"value": "0, 0"
5+
"type": "geo:json",
6+
"value": {
7+
"coordinates": [
8+
0,
9+
0
10+
],
11+
"type": "Point"
12+
}
713
}
8-
}
14+
}

test/unit/ngsiv2/examples/contextRequests/createGeopointProvisionedDevice.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
"id": "FirstMicroLight",
33
"type": "MicroLights",
44
"location": {
5-
"type": "geo:point",
6-
"value": "0, 0"
5+
"type": "geo:json",
6+
"value": {
7+
"coordinates": [
8+
0,
9+
0
10+
],
11+
"type": "Point"
12+
}
713
}
8-
}
14+
}

test/unit/ngsiv2/examples/contextRequests/updateContextStaticAttributes.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"type": "boolean"
55
},
66
"location":{
7-
"value": "153,523",
8-
"type": "geo:point"
7+
"value":{
8+
"type":"Point",
9+
"coordinates":[153,523]
10+
},
11+
"type": "geo:json"
912
}
10-
}
13+
}

0 commit comments

Comments
 (0)