Follow us

Realtime geofencing

GPS & Uber-like apps made easy

Kuzzle's pub/sub engine provides a powerful geofencing feature, to define & combine boundaries, distance, distance range & free polygons.
Geofencing can be used to push notifications (e.g. out of zone detection) or build any data stream related to geographical data (e.g. GPS data stream).
Read the documentation to learn more

Case Study

Geo objects (IoT) out-of-zone realtime detection

Kuzzle Backend enables live-tracking of a set of connected bikes and sends notifications when they enter or exit any polygon area.

Blazing fast realtime geofencing engine

Developers' corner - SDK(s) examples

Reduce development time and learning curve with Kuzzle SDK(s). They provide high level functions to make developers' life simpler.
Read the documentation to learn more

  • Javascript
  • Android
  • GO
  • // Subscribe to document leaving a geodistance perimeter
            
              var filter = {
                geoDistance: {
                  location: {
                    lat: 51.5029017,
                    lon: -0.1606903
                  },
                  distance: '10km'
                }
              }
            
              kuzzle
                  .collection('mycollection', 'myindex')
                  .subscribe(filter, {scope: 'out'}, function(error, result) {
                  // triggered each time a document leaving the geodistance filter !
                  console.log('Document is leaving the perimeter:', result)
              })
            
    // Update a document (that will notify client that subscribed with the code above)
            
              /*
              Existing document within the geodistance perimeter, stored into Kuzzle:
              {
                _id: '326c8f08-63b0-429f-8917-b782d30930e9',
                firstName: 'Ada',
                lastName: 'Lovelace',
                location: {
                  lat: 51.519291,
                  lon: -0.149817
                }
              }
              */
            
              var newLocation = {
                lat: 32.692742,
                lon: -97.114127
              }
            
              kuzzle
                  .collection('mycollection', 'myindex')
                  .updateDocument('326c8f08-63b0-429f-8917-b782d30930e9', {location: newLocation})
                
  • // Subscribe to document leaving a geodistance perimeter
            
                        JSONObject filter = new JSONObject()
                  .put("geoDistance", new JSONObject
                      .put("location", new JSONObject
                          .put("lat": 51.5029017)
                          .put("lon": -0.1606903))
                      .put("distance", "10km"));
            
              kuzzle.collection("mycollection", "myindex")
                .subscribe(filter, new RoomOptions().setScope("out"), new ResponseListener<NotificationResponse>() {
                  @Override
                  public void onSuccess(NotificationResponse object) {
                    // triggered each time a document leaving the geodistance filter
                    System.out.println("Document is leaving the perimeter:" + object.getResult().toString());
                  }
                });
                      
    // Update a document
            
                        JSONObject newLocation = new JSONObject()
                .put("lat": 32.692742)
                .put("lon": -0.1606903);
            
            kuzzle.collection("mycollection", "myindex")
                .updateDocument("326c8f08-63b0-429f-8917-b782d30930e9", newLocation);
                          
  • 
            ro := types.NewRoomOptions()
            cn := websocket.NewWebSocket(":7512", o)
            k, _ := kuzzle.NewKuzzle(cn, o)
            c := collection.NewCollection(k, "mycollection", "myindex")
            
            // Subscribe to document leaving a geodistance perimeter
            type Location struct {
              Lat float64 `json:"lat"`
              Lon float64 `json:"lon"`
            }
            type GeoDistance struct {
              Location Location `json:"location"`
              Distance string `json:"distance"`
            }
            type GeofencingFilters struct {
              GeoDistance GeoDistance `json:"geoDistance"`
            }
            
            var filters = GeofencingFilters{
              GeoDistance: GeoDistance{
                Location: Location{
              	  Lat: 51.5029017,
              	  Lon: -0.1606903,
            	},
            	Distance: "10km",
              },
            }
            rtc := make(chan types.KuzzleNotification)
            res := <- c.Subscribe(filters, ro.SetScope("out"), rtc)
            
            go func (rtc chan types.KuzzleNotification) {
              fmt.Println("Document is leaving the perimeter: ")
              fmt.Println(<-rtc)
            }(rtc)
            
    
            // Update a document (that will notify client that subscribed with the code above)
            
            var newLocation = Location{
              Lat: 32.692742,
              Lon: -97.114127,
            }
            
            res, err := c.updateDocument("326c8f08-63b0-429f-8917-b782d30930e9", newLocation, nil)
            

They Trust us