Set

Set the value of an id. If a value is already associated to that key/id, it’ll be overwritten.

Examples

Set a simple point in latitude, longitude.

$ SET fleet truck1 POINT 33.5123 -112.2693

A point with Z coordinate. This is application specific such as elevation, or a timestamp, etc.

$ SET fleet truck1 POINT 33.5123 -112.2693 245.0

minimum bounding rectangle. The values are (southwest latitude, southwest longitude, northeast latitude, northeast longitude).

$ SET props house1 BOUNDS 33.7840 -112.1520 33.7848 -112.1512

Geohash. A geohash is a convenient way of expressing a location (anywhere in the world) using a short alphanumeric string, with greater precision obtained with longer strings.

$ SET props area1 HASH 6bscvk

GeoJSON object. GeoJSON is an industry standard format for representing a variety of object types including a point, multipoint, linestring, multilinestring, polygon, multipolygon, geometrycollection, feature, and featurecollection. Tile38 supports all of the standards with these exceptions.

  1. The crs member is not supported and will be ignored. The CRS84/WGS84 projection is assumed.
  2. Any member that is not recognized (including crs) will be ignored.
  3. All coordinates can be 2 or 3 axes. Less than 2 axes or more than 3 will result in a parsing error.

* All ignored members will not persist.

Important to note that all GeoJSON coordinates are in Longitude, Latitude order.

$ SET cities tempe OBJECT {«type»:»Polygon»,»coordinates»:[[[-111.9787,33.4411],[-111.8902,33.4377],[-111.8950,33.2892],[-111.9739,33.2932],[-111.9787,33.4411]]]}

Options

SET supports a set of options that modify its behavior:

  • EX seconds – Set the specified expire time, in seconds.
  • NX – Only set the object if it does not already exist.
  • XX – Only set the object if it already exist.

Fields

Fields are extra data which belongs to an object. A field is always a double precision floating point. There is no limit to the number of fields that an object can have.

To set a field when setting an object.

$ SET fleet truck1 FIELD speed 90 POINT 33.5123 -112.2693 SET fleet truck1 FIELD speed 90 FIELD age 21 POINT 33.5123 -112.2693

It’s also possible to set a field when an object already exists. See FSET.

Z Coordinate

z coordinate allows for optimized range queries for values such as Elevation and Timestamps.

To set the z coordinate:

$ SET fleet truck1 POINT 33.5123 -112.2693 115 SET fleet truck1 OBJECT {«type»:»Point»,»coordinates»:[33.5123,-112.2693,115]}

Now queries can search the z coordinate by treating it as a field:

$ NEARBY 1 WHERE z -15 130 POINTS 33 -115 100000

Which will look for all points that are within 100 kilometers of 33,-115 and have a z coordinate between -15 and 130. notice the lowercase z in the WHERE clause

Strings

It’s possible to set a raw string by using the STRING keyword. The value of a string type can be plain text or a series of raw bytes. To retrieve a string value you can use GET, SCAN, or SEARCH.

$ SET fleet truck1:driver STRING «John Denton»

EnglishРусский