Skip to content

Conversation

jason-fox
Copy link
Contributor

@jason-fox jason-fox commented Sep 7, 2020

Add GeoProperty, Point , Date and Time types since GeoJSON is native in NGSI-LD.

NGSI-v2

The following provisioning statement is valid:

curl -L -X POST 'http://localhost:4041/iot/services' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
--data-raw '{
  "services": [
    {
      "apikey": "4jggokgpepnvsb2uv4s40d59ov",
      "cbroker": "http://orion:1026",
      "entity_type": "Device",
      "resource": "/iot/d",
      "attributes": [
        {
          "object_id":"bpm",
          "type":"Float",
          "name": "heartRate"
        },
        {
          "object_id": "s",
          "name": "status",
          "type": "String"
        },
        {
          "object_id": "gps",
          "name": "location",
          "type": "geo:point"
        }
      ]
    }
  ]
}'

NGSI-LD

The following equivalent provisioning statement should be valid for NGSI-LD:

curl -L -X POST 'http://localhost:4041/iot/services' \
-H 'fiware-service: openiot' \
-H 'fiware-servicepath: /' \
--data-raw '{
  "services": [
    {
      "apikey": "4jggokgpepnvsb2uv4s40d59ov",
      "cbroker": "http://orion:1026",
      "entity_type": "Device",
      "resource": "/iot/d",
      "attributes": [
        {
          "object_id":"bpm",
          "type":"Property",
          "name": "heartRate"
        },
        {
          "object_id": "s",
          "name": "status",
          "type": "Property"
        },
        {
          "object_id": "gps",
          "name": "location",
          "type": "GeoProperty"
        }
      ]
    }
  ]
}'

but currently fails since GeoProperty is not defined as an exception and the default string value " " is not valid GeoJSON.

Add GeoProperty, Point , Date and Time types since GeoJSON is native in NGSI-LD
@jason-fox
Copy link
Contributor Author

Note that it should be discussed if further additions should be required for LineString etc. I have not added them here because GeoProperty is a catch-all, however if necessary they should be added to #854

Comment on lines -40 to -42
case LOCATION_TYPE:
switch (type.toLowerCase()) {
case 'geoproperty':
return LOCATION_DEFAULT;
case DATETIME_TYPE:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any other usage of LOCATION_TYPE and DATETIME_TYPE (removed in this PR) appart of the ones in this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't look like it, so those statements are now redundant and can be removed. Fixed 9d65c09

Copy link
Member

@fgalan fgalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Shoud I merge? Or some other (with a better knowledge on NGSI-LD) should provide additional LGTM before that?

@jason-fox
Copy link
Contributor Author

Please merge.

@fgalan fgalan merged commit 4c9313a into telefonicaid:feature/842_ngsi_ld Sep 8, 2020
@jason-fox jason-fox deleted the patch-2 branch September 9, 2020 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants