FAQ: how to use the index for query by value on stored time series data

Snap4City provides support for making ASCAPI queries and selections (Selector for the MultiDataMap) by filtering by values of some variable as described in the training parts P2 and P7.

For example:

https://www.xxxx.com/superservicemap/api/v1/iot-search?selection=40.998331876446;16.612248697857;41.248331876446;17.1122...

where parameters are:

selection=40.998331876446;16.612248697857;41.248331876446;17.112248697857&
categories=Traffic_light&maxResults=200&
format=json&
model=TrafficLightDeviceModel_v01&
valueFilters=state>3

Please note that the operators on numbers such as > and < work only if the data are loaded as numbers and not strings.  
What is relevant is how the data is sent on the ingestion Broker if it is sent as "1" is a string, while if it is sent as 1 or 1.0 is a number

On string you can only use the compare as = 

Please note that /iot-search is filtering on the basis of the last value of each device, while /iot-search/time-range allows to specify the historical data

------------------------

The base url is https://www.snap4city.org/superservicemap/api/v1/iot-search/?...

Query params are similar to other apis:

selection=…

  • The base url is https://www.snap4city.org/superservicemap/api/v1/iot-search/?...
  • Query params are similar to other apis:
    • selection=…
      • A GPS point <latitude>;<longitude>
      • A GPS rectangular area <lat1>;<long1>;<lat2>;<long2>
      • A service uri (uses its lat;lon position)
      • More complex geographic filters are not supported
    • maxDists=..
      • Maximum distance in km from the GPS point (default 0.1 km)
    • categories=…
      • A list of categories as nature and subnature separated by ";"
    • model=…
      • Search for devices of a specific model (only one allowed)
    • serviceUri=<suri1>;<suri2>…
      • Filters on specific service uris
    • text=…
      • Filters using keywords and phrases to be searched in any string value of the device (phrases are delimited by "...")
    • valueFilters=<cond1>;<cond2>;…
      • A set of conditions in AND on specific values (the verification of equal condition is «=» or «:» depending on the data type)
        • <value name>:<string> (ex. Status:Active)
        • <value name>(=|<|<=|>=|>)<number> (ex. temperature>38)

--SnapAdvisor--