master
Raw Download raw file
 1import zmq
 2import time
 3from random import uniform
 4from geojson import Point as point
 5from geojson import Feature as feature
 6context = zmq.Context()
 7socket = context.socket(zmq.PUB)
 8socket.bind("tcp://127.0.0.1:5000")
 9 
10def point_plus_accuracy(lat=None, lon=None, accuracy=None):
11  if lat is None: lat = uniform(-180,180)
12  if lon is None: lon = uniform(-90,90)
13  if accuracy is None: accuracy = uniform(0,20000)
14  return feature(geometry=point((lat,lon)), property={'accuracy': accuracy})
15
16while True:
17    msg = point_plus_accuracy()
18    #print "->",msg
19    socket.send_json(msg)
20    time.sleep(uniform(0.01,1))