def get(self): """ Return carshare lots and data around the point defined by (x, y) """ args = carshare_parser.parse_args() city = City.get(args['longitude'], args['latitude']) if not city: api.abort(404, "no feature found") res = Carshares.get_lots_within(city, args['longitude'], args['latitude'], args['radius'], args['company'] or False) if not res and args["nearest"]: res = Carshares.get_lots_nearest(city, args["longitude"], args["latitude"], args["nearest"], args['company'] or False) return FeatureCollection([ Feature(id=feat[0], geometry=feat[1], properties={ field: feat[num] for num, field in enumerate( Carshares.lot_properties[2:], start=2) }) for feat in res ]), 200
def get(self): """ Returns slots around the point defined by (x, y) """ args = slots_parser.parse_args() args['compact'] = args['compact'] not in ['false', 'False', False] args['carsharing'] = args['carsharing'] not in [ 'false', 'False', False ] # push map search data to analytics Analytics.add_pos_tobuf("slots", g.user.id, args["latitude"], args["longitude"], args["radius"]) city = City.get(args['longitude'], args['latitude']) if not city: api.abort(404, "no feature found") res = Slots.get_within(city, args['longitude'], args['latitude'], args['radius'], args['duration'], slot_props, args['checkin'], args['permit'], args['carsharing']) return FeatureCollection([ Feature(id=feat['id'], geometry=feat['geojson'], properties=cpt_props(feat) if args['compact'] else nrm_props(feat)) for feat in res ]), 200
def post(self): """Submit a report about incorrect data""" args = report_parser.parse_args() city = args["city"] if not args["city"]: city = City.get(args['longitude'], args['latitude']) Reports.add(g.user.id, city, args.get("slot_id", None), args["longitude"], args["latitude"], args.get("image_url", ""), args.get("notes", "")) return "Resource created", 201
def get(self): """ Return parking lots and garages around the point defined by (x, y) """ args = parking_lot_parser.parse_args() if not args.get("latitude") and not args.get( "longitude") and not args.get("partner_id"): return "Requires either lat/long or partner_id", 400 if args.get("partner_id"): res = ParkingLots.get_bypartnerid(args.get("partner_name"), args["partner_id"]) else: # push map search data to analytics Analytics.add_pos_tobuf("lots", g.user.id, args["latitude"], args["longitude"], args["radius"]) city = City.get(args['longitude'], args['latitude']) if not city: api.abort(404, "no feature found") res = ParkingLots.get_within(args["longitude"], args["latitude"], args["radius"]) if not res and args["nearest"]: res = ParkingLots.get_nearest(args["longitude"], args["latitude"], args["nearest"]) return FeatureCollection([ Feature(id=feat[0], geometry=feat[1], properties={ field: feat[num] for num, field in enumerate(ParkingLots.properties[2:], start=2) }) for feat in res ]), 200
def get(self): """ Returns slots around the point defined by (x, y) """ args = slot_parser.parse_args() city = City.get(args['longitude'], args['latitude']) if not city: api.abort(404, "no feature found") res = Slots.get_within(city, args['longitude'], args['latitude'], args['radius'], args['duration'], slot_props, args['checkin'], args['permit'] in ['false', False], args['permit'] == 'all') return FeatureCollection([ Feature(id=feat['id'], geometry=feat['geojson'], properties={ "button_location": feat["button_location"], "rules": feat["rules"], "way_name": feat["way_name"] }) for feat in res ]), 200