I've been looking at the documentation, and there is no complete working example of a GeoJSON Point encoding for the JEXL parser:
I currently have the following:
{
"devices": [
{
"device_id": "motion010",
"entity_name": "urn:ngsi-ld:Motion:010",
"entity_type": "Motion",
"timezone": "Europe/Berlin",
"expressionLanguage": "jexl",
"attributes": [
{
"name": "location",
"type": "geo:point",
"expression": "longitude + \",\" + latitude"
},
{
"name": "TimeInstant",
"type": "DateTime",
"expression": "level|toisodate"
},
{
"name": "level",
"type": "Number"
},
{
"name": "latitude",
"type": "Number"
},
{
"name": "longitude",
"type": "Number"
}
]
}
]
}
Which results in the following:
{
"id": "urn:ngsi-ld:Motion:010",
"type": "Motion",
"TimeInstant": {
"type": "DateTime",
"value": "2021-11-18T14:20:14.901Z",
"metadata": {}
},
"latitude": {
"type": "Number",
"value": 1,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2021-11-18T14:20:14.901Z"
}
}
},
"level": {
"type": "Number",
"value": 1637245214901,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2021-11-18T14:20:14.901Z"
}
}
},
"location": {
"type": "geo:point",
"value": "7,1",
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2021-11-18T14:20:14.901Z"
}
}
},
"longitude": {
"type": "Number",
"value": 7,
"metadata": {
"TimeInstant": {
"type": "DateTime",
"value": "2021-11-18T14:20:14.901Z"
}
}
}
}
But instead of:
"type": "geo:point", "value": "7,1"
I would like to have
"type": "geo:point", "value": {"coordinates": [7,1], "type": "Point"}
and I can't see how to encode the quotation marks within the provisioning statement. The closest I can get in the JEXL Playground is single quote which won't work with a jsonparse function.
I've been looking at the documentation, and there is no complete working example of a GeoJSON
Pointencoding for the JEXL parser:I currently have the following:
{ "devices": [ { "device_id": "motion010", "entity_name": "urn:ngsi-ld:Motion:010", "entity_type": "Motion", "timezone": "Europe/Berlin", "expressionLanguage": "jexl", "attributes": [ { "name": "location", "type": "geo:point", "expression": "longitude + \",\" + latitude" }, { "name": "TimeInstant", "type": "DateTime", "expression": "level|toisodate" }, { "name": "level", "type": "Number" }, { "name": "latitude", "type": "Number" }, { "name": "longitude", "type": "Number" } ] } ] }Which results in the following:
{ "id": "urn:ngsi-ld:Motion:010", "type": "Motion", "TimeInstant": { "type": "DateTime", "value": "2021-11-18T14:20:14.901Z", "metadata": {} }, "latitude": { "type": "Number", "value": 1, "metadata": { "TimeInstant": { "type": "DateTime", "value": "2021-11-18T14:20:14.901Z" } } }, "level": { "type": "Number", "value": 1637245214901, "metadata": { "TimeInstant": { "type": "DateTime", "value": "2021-11-18T14:20:14.901Z" } } }, "location": { "type": "geo:point", "value": "7,1", "metadata": { "TimeInstant": { "type": "DateTime", "value": "2021-11-18T14:20:14.901Z" } } }, "longitude": { "type": "Number", "value": 7, "metadata": { "TimeInstant": { "type": "DateTime", "value": "2021-11-18T14:20:14.901Z" } } } }But instead of:
I would like to have
and I can't see how to encode the quotation marks within the provisioning statement. The closest I can get in the JEXL Playground is single quote which won't work with a
jsonparsefunction.