RSQL
RSQL
Syntax
RSQL is a query language for RESTful APIs. It uses an URI-friendly syntax, there
are no unsafe characters, so URL encoding is not required. It supports some
logical and comparison operators and can be easily extended by custom operators.
You find more detailed information on RSQL at
https://github.com/jirutka/rsql-parser.
Available Operators
Data Client Library supports all standard RSQL operators as there are:
| Operator | Alternative Syntax | Meaning | Example |
|---|---|---|---|
== | Equal to | tileId==91717 | |
!= | Not equal to | tileId!=91717 | |
< | =lt= | Less than | limit<100 or limit=lt=100 |
<= | =le= | Less than or equal | limit<=100 or limit=le=100 |
> | =gt= | Greater than operator | limit>100 or limit=gt=100 |
>= | =ge= | Greater than or equal to | limit>=100 or limit=ge=100 |
=in= | =IN= | In | tileId=in=(91717,91718) |
=out= | Not in | tileId=out=(91717,91718) |
Data Client Library supports standard or and and RSQL operators depending on
layer type (see below):
| Operator | Meaning | Example |
|---|---|---|
or | Logical OR | tileId==91717 or limit<100 |
and | Logical AND | tileId!=91717 and limit<100 |
Additionally, Data Client Library supports the following custom operators:
Note: You can use uppercase custom operators but the RSQL guide suggests
to lowercase operators.
| Operator | Alternative Syntax | Meaning | Example |
|---|---|---|---|
=inboundingbox= | =INBOUNDINGBOX= | In area described by bounding box | =inboundingbox=(northLatitude, southLatitude, eastLongitude, westLongitude)e.g. for Munich =inboundingbox=(48.2292, 48.0417, 11.7490, 11.3771)coordinates are in decimal degrees |
=incircle= | =INCIRCLE= | In area described by circle | =circle=(centerLatitude, centerLongitude, radiusInMeters)e.g. circle covering Munich Airport =circle=(48.3536621, 11.7750279, 5000)coordinates are in decimal degrees |
=inpolygon= | =INPOLYGON= | In area described by polygon | =inpolygon=(long1,lat1,long2,lat2,...)coordinates are in decimal degrees |
=changes= | =CHANGES= | Version range from min. version to max. version | =changes=(minVer,maxVer)e.g. =changes=(100,200) |
=contains= | =CONTAINS= | Checks if field contains a string | =contains=(string)e.g. =contains=(food) |
Supported Operators per Layer Type
Data Client Library uses RSQL to query or select specific data. As the data
which is stored in different layer types has a different structure it supports
different operators per layer type.
The following chapters show all available operators and attributes per layer
type. For ease of view the alternatives are not listed here though they are
supported.
Index Layer
Supported Operators:
- all standard operators
andandoroperators=inboundingbox==incircle==inpolygon=
Supported Attributes:
tileIdtimestamptimewindow
Note:
- If you use the
timeStampattribute or a field oftimewindowtype the time
is in UTC milliseconds since epoch (Jan 1, 1970 00:00:00 AM UTC). If you run
your application in another timezone, make sure that the timestamp is
converted into UTC before you query or upload data. In Java or Scala you can
do the conversion by using this function call:
Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTimeInMillis()
Limitations:
- The maximum number of tiles returned by a spatial query cannot exceed 2000.
- For optimal query performance, use the
timewindowindexing attribute. - The
timestampandtimewindowindexing attributes cannot be used in the
same query.
Note: Thetimewindowattribute cannot be used directly in a
query as it consists of a name and a duration, for example, the name could be
ingestionTimeand the duration 60 (minutes). In this case the query would
useingestionTime.
Examples:
tileId==91717tileId=in=(91717,91718)(returns these two partitions)tileId=inboundingbox=(48.2292, 48.0417, 11.7490, 11.3771)(returns all
partitions of Munich for zoom level as defined in layer config)tileId=in=(FOO,BAR)(returns two partitions from a layer which does not use
HERE tiling schema but generic tiling schema and has partitions namedFOO
andBAR)timestamp==1552383031000(milliseconds since epoch; March 12, 2019 09:30:31
AM GMT)ingestionTime>1552382100000;ingestionTime<1552385700000(greater than March
12, 2019 9:15:00 AM and less than March 12, 2019 10:15:00 AM)
For more details on queries for index layer data, see
Get Data from an Index Layer
section of the Data API Developer Guide.
Versioned Layer
Supported Attributes:
mt_partitionmt_version
Supported Operators per Attribute:
mt_partition===in==inboundingbox=
mt_version===changes=
andoperator
Limitations:
- Attributes
mt_partitionandmt_versioncriteria can be combined withand
operator. Combining them with OR operator is not supported. - There can be max. 2 comparison operators.
=changes=operator applies formt_versiononly.- For
=changes=operator min. version must be less than or equal to max.
version. Min. version is exclusive. If the version specified has been deleted,
the lowest existing version is assumed. Max. version is inclusive. It must be
greater than min. version. ==operator withmt_versioncan use special keywordLATESTwhich queries
for the latest version without explicitly defining it.
Examples:
mt_version==100mt_version==LATESTmt_version=changes=(100,200)mt_partition==91717(implicitly uses latest version)mt_partition==91717 and mt_version==100mt_partition=in=(91717,91718)(returns latest versions of these two
partitions)mt_partition=inboundingbox=(48.2292, 48.0417, 11.7490, 11.3771)(returns
latest versions of all partitions of Munich)mt_partition=in=(FOO,BAR)(returns latest versions of these two partitions
from a layer which does not use HERE tiling schema but generic tiling schema
and has partitions namedFOOandBAR)
Volatile Layer
Supported Attributes:
mt_partitionmt_timestamp
Supported Operators per Attribute:
mt_partition===in==inboundingbox=
mt_timestamp=ge=(translates tosinceattribute for volatile partitions filter)
andoperator
Limitations:
- Attributes
mt_partitionandmt_timestampcriteria can be combined with
andoperator. Combining them with OR operator is not supported. - There can be max. 2 comparison operators.
=ge=operator applies formt_timestamponly.
Examples:
mt_partition==91717(implicitly ignores partition if partition is expired)mt_partition==91717 and mt_timestamp=ge=1552383031000(milliseconds since
epoch; March 12, 2019 09:30:31 AM GMT)mt_partition=in=(91717,91718)(returns these two partitions if not expired)mt_partition=inboundingbox=(48.2292, 48.0417, 11.7490, 11.3771)(returns all
partitions of Munich if not expired)mt_timestamp=ge=1552383031000(returns all partitions which were updated
since milliseconds since epoch; March 12, 2019 09:30:31 AM GMT)
Interactive Map Layer
Supported Attributes:
mt_quadkeysmt_geometrymt_idmt_propertymt_selection
Supported Operators per Attribute:
mt_quadkeys===in=
mt_id===in=
mt_geometry=inboundingbox==inpolygon=
mt_selectionthis attribute will create a projection of the properties in
the object, e.g. mt_selection==p.foo will return only the property foo===in=
f|p.*any attribute starting withf.orp..p.is for selecting fields
in the feature's properties, andf.is for selecting fields in the feature's
root level==!=>>=<<==contains=this operation will check if a string is in the field
andoperator
Limitations:
- Query must be either empty or must contain at most one
mt_quadkey,mt_id
ormt_geometry. - Bounding box or polygon must be inside the bounds:
- Longitude:
[-180, 180] - Latitude:
[-85.05112878, 85.05112878]
- Longitude:
- For bounding box north latitude must be greater than south latitude.
- Delete Queries only support
mt_id. This means you can only delete objects by
its ID.
NOTE: empty RSQL delete query will delete everything.
Examples:
mt_quadkeys==012313mt_quadkeys==012313 and f.timestamp>1552383031000(returns all objects in
QuadKey 012313 having a property timestamp with milliseconds since epoch;
March 12, 2019 09:30:31 AM GMT)mt_quadkeys=in=(012313,012312)(returns these two QuadKeys)mt_geometry=inboundingbox=(48.2292, 48.0417, 11.7490, 11.3771)(returns all
objects in Munich)mt_geometry=inboundingbox=(48.2292, 48.0417, 11.7490, 11.3771) and mt.selection==p.foo
(returns only the property foo of all objects in Munich)mt_geometry=inboundingbox=(48.2292, 48.0417, 11.7490, 11.3771) and p.foo=contains=bar
(returns all objects in Munich having a field foo in properties and this field
contains the stringbar, for example, bar, 123bar, mybarfirst)