Skip to content

Provisioning an Individual Device with GeoJson Attribute #961

@rezendel

Description

@rezendel

Hello,

I am trying to integrate a device with the maps widget on wirecloud.(mashups). I want to make sure that the data format is right

Is this the right syntax when provisioning a device?

      sudo curl -iX POST \
  'http://localhost:4041/iot/devices' \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: openiot' \
  -H 'fiware-servicepath: /' \
  -d '{
 "devices": [
   {
     "device_id":   "gps0022",
     "entity_name": "urn:ngsi-ld:Gps:0022",
     "entity_type": "Gps18",
     "transport":   "MQTT",
     "timezone":    "America/Sao_Paulo",
     "attributes": [
       **{ "object_id": "l", "name":"coordinates","type":"Point"}**
     ]
   }
 ]
}'

I get this result:

 {
  "id":"urn:ngsi-ld:Gps:0023",
  "type":"Gps18",
  "TimeInstant":{
  	"type":"DateTime",
  	"value":"2020-12-10T16:33:13.366Z",
  	"metadata":{}
  		},
  **"coordinates":{
  	"type":"Point",
  	"value":[10.2424,45.5642],**
  	"metadata":{"TimeInstant":{"type":"DateTime","value":"2020-12-10T16:33:13.366Z"}}}}

I have also tried the following:

     **{ "object_id": "l", "name":"location","type":"Geojson"}**

then the result is:

{"id":"urn:ngsi-ld:Gps:0023","type":"Gps18","TimeInstant":{"type":"DateTime","value":"2020-12-10T17:58:21.706Z","metadata":{}},

          **"location":{"type":"Geojson",
           "value":[66.2424,45.5642],**
                      "metadata":{"TimeInstant":{"type":"DateTime","value":"2020-12-10T17:58:21.706Z"}}}}
**note: geo.json didn't work**

the geolocation attribute structure is different from the example the fiware documentation.

 **"location": {
        "type": "geo:json",
        "value": {
             "type": "Point",
             "coordinates": [13.3986, 52.5547]
        }
    },**

Should the data be like this so I can integrate with the application map mashups? If so, how should I defined the attributes?

Note: I am not a JSON expert :D

thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions