def main(args): routeParser = RouteParser(args.input) route =routeParser.parse() routeManager = RouteManager(route, args.noise, args.step) locations = routeManager.applyEffects() # routeManager.routePrint() if(args.type == "kml"): if(args.output is None): exportXml(locations) else: exportXml(locations, args.output) else: if (args.output is None): exportCsv(locations) else: exportCsv(locations, args.output)
def main(): route = Route() # Creamos un objeto ruta # JSON con vectores de pruebas jDirections = [ '{"latitude": 41.967782, "longitude": 2.837736, "speed": 1.3}', '{"latitude": 41.967691, "longitude": 2.837481, "speed": 0.1}', '{"latitude": 41.967657, "longitude": 2.837486, "speed": 1}', '{"latitude": 41.967175, "longitude": 2.836808, "speed": 1.3}', '{"latitude": 41.967418, "longitude": 2.836306, "speed": 0}' ] # Anadimos a la ruta for x in xrange(len(jDirections)): direction = json.loads(jDirections[x], object_hook = as_direction) route.addDirection(direction) # Creamos un manager con la ruta routeMgr = RouteManager(route) # Generamos las ubicaciones exportandolas a kml y csv. locations = routeMgr.applyEffects() exportXml(locations, "std-test.kml") exportCsv(locations, "std-test.csv") # Anadimos multiplicador de pasos y exportamos routeMgr.stepMultiplier = 4 locations = routeMgr.applyEffects() exportXml(locations, "step-test.kml") exportCsv(locations, "step-test.csv") # Anadimos ruido y exportamos routeMgr.noise = 20 locations = routeMgr.applyEffects() exportXml(locations, "step-noise-test.kml") exportCsv(locations, "step-noise-test.csv") # Quitamos multiplicador y dejamos solo ruido routeMgr.stepMultiplier = 0 locations = routeMgr.applyEffects() exportXml(locations, "noise-test.kml") exportCsv(locations, "noise-test.csv")