6.2 Use Case: Query parking sites in the vicinity (UC1)
Use Case 1 (UC1) is about querying for parking sites within a given geographic area, e.g. around the current location of a car. Figure 6.2-1 visualizes this scenario.
Figure 6.2-1: UC1 - Query parking sites in the vicinity
The basis for modelling the information required for this use case is the NGSI-LD compatible Smart Data Model[i.5] on Parking, which makes a distinction between OffStreetParking and OnStreetParking. As this distinction is not relevant for our use case, we restrict the example on a number of common NGSI-LD properties: - address - allowedVehicleType - availableSpotNumber - category - chargeType - location
The query for parking sites within a given geographic area, e.g. around the current location of a car:
GET /ngsi-ld/v1/entities/?type=OnStreetParking,OffStreetParking&geoproperty=location&georel=near%3BmaxDistance==1000&geometry=Point&coordinates[-3.8040616,43.4631649]
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"
Excerpt of result:
[{
"id": "urn:ngsi-ld:OnStreetParking:santander:daoiz_velarde_1_5",
"type": "OnStreetParking",
"allowedVehicleType": {
"type": "Property",
"value": [
"car"
]
},
"availableSpotNumber": {
"type": "Property",
"value": 3,
"observedAt": "2018-09-12T12:00:00Z"
},
"category": {
"type": "Property",
"value": [
"blueZone",
"shortTerm",
"forDisabled"
]
},
"chargeType": {
"type": "Property",
"value": [
"temporaryFee"
]
...
The advantages for the application are the following: - Application can reuqest information by specifying what it needs ("parking sites in the vicinity") - Application gets result with a single request (unless paging is required due to number of results) - Application can gegographically scope the request
In order to do this, the application needs to know the following: - Data model: - type: OnStreetParking, OffStreetParking - GeoProperty name: location - its current location - Root URL: localhost:9090