6.3 Use Case: Query parking sites in the vicinity (UC2)
Use Case 2 (UC2) is about querying for a free parking spot within the proximity of a car. Figure 6.3-1 visualizes this scenario.
Figure 6.3-1: UC2 - Query for free parking spots in the proximity
The NGSI-LD Entity Type used is ParkingSpot, also from the NGSI-LD compatible Smart Data Model[i.5] on Parking. For this purpose, we are only interested in the following properties of each parking spot: - categrory - location - name - parkingSite (relation) - status
The query for parking spots within a given geographic area, e.g. within 100m around the current location of a car, filtered according to the status being free and restricting the result to the elments: id, type, category, location, name and status:
GET /ngsi-ld/v1/entities/?type=ParkingSpot&geoproperty=location&georel=near%3BmaxDistance==100&geometry=Point&coordinates=[-3.8040616,43.4631649]&q=status==“free”&pick=id,type,category,location,name,status
Accept: application/json
Host: localhost:9090
Link: <http://example.org/myContext.jsonld>; rel="http://www.w3.org/ns/json-ld#context"; type="application/ld+json"
[{
"id": "urn:ngsi-ld:ParkingSpot:santander:daoiz_velarde_1_5:3",
"type": "ParkingSpot",
"category": {
"type": "Property",
"value": [
"onStreet"
]
},
"location": {
"type": "GeoProperty",
"value": {
"type": "Point",
"coordinates": [
-3.80356167695194,
43.46296641666926
]
}
},
"name": {
"type": "Property",
"value": "A-13"
"status": {
"type": "Property",
"value": "free",
"observedAt": "2018-09-21T12:00:00Z“
}
},
...
The advantages for the application are the following: - Application can reuqest information by specifying what it needs ("free parking spaces in the close vicinity") - Application gets result with a single request (unless paging is required due to number of results) - Application can gegographically scope the request - Application can filter by status, i.e. only get “free” parking spaces - Application can project to only get the properties and relationships they are interested in
In order to do this, the application needs to know the following: - Data model: - type: ParkingSpot - GeoProperty name: location - Property names: category, location, name and status – and its possible values (“free”) - its current location - Root URL: localhost:9090