def testTripGeojson(self): eaist.segment_current_trips(self.testUUID) eaiss.segment_current_sections(self.testUUID) eaicl.filter_current_sections(self.testUUID) tl = esdtl.get_raw_timeline(self.testUUID, 1440658800, 1440745200) self.assertEquals(len(tl.trips), 8) eaicr.clean_and_resample(self.testUUID) tl = esdtl.get_cleaned_timeline(self.testUUID, 1440658800, 1440745200) tl.fill_start_end_places() created_trips = tl.trips self.assertEquals(len(created_trips), 7) trip_geojson = gjfc.trip_to_geojson(created_trips[0], tl) logging.debug("first trip_geojson = %s" % bju.dumps(trip_geojson, indent=4)) self.assertEquals(trip_geojson.type, "FeatureCollection") self.assertEquals(trip_geojson.properties["feature_type"], "trip") self.assertEquals(len(trip_geojson.features), 5) day_geojson = gjfc.get_geojson_for_timeline(self.testUUID, tl) self.assertEquals(len(day_geojson), 7) self.assertEquals(day_geojson[-1].type, "FeatureCollection") self.assertEquals(day_geojson[-1].properties["feature_type"], "trip") self.assertEquals(len(day_geojson[-1].features), 5)
def testTripGeojson(self): eaist.segment_current_trips(self.testUUID) eaiss.segment_current_sections(self.testUUID) eaicl.filter_current_sections(self.testUUID) tl = esdtl.get_raw_timeline(self.testUUID, 1440658800, 1440745200) self.assertEquals(len(tl.trips), 9) eaicr.clean_and_resample(self.testUUID) eacimp.predict_mode(self.testUUID) tl = esdtl.get_cleaned_timeline(self.testUUID, 1440658800, 1440745200) tl.fill_start_end_places() created_trips = tl.trips self.assertEquals(len(created_trips), 9) trip_geojson = gjfc.trip_to_geojson(created_trips[0], tl) logging.debug("first trip_geojson = %s" % bju.dumps(trip_geojson, indent=4)) self.assertEquals(trip_geojson.type, "FeatureCollection") self.assertEquals(trip_geojson.properties["feature_type"], "trip") self.assertEquals(len(trip_geojson.features), 5) day_geojson = gjfc.get_geojson_for_timeline(self.testUUID, tl) self.assertEquals(len(day_geojson), 8) self.assertEquals(day_geojson[-1].type, "FeatureCollection") self.assertEquals(day_geojson[-1].properties["feature_type"], "trip") self.assertEquals(len(day_geojson[-1].features), 5)
def Berkeley_pop_route(start_dt, end_dt): box = [ [-122.267443, 37.864693], [-122.250985, 37.880687] ] tl = esdt.get_aggregate_timeline_from_dt(start_dt, end_dt, box) gj_list = gfc.get_geojson_for_timeline(None, tl, viz=True) list_of_points=[] for gj in gj_list: for feature in gj: if feature['type'] == 'FeatureCollection': for feat in feature['features']: if "properties" not in feat: continue if feat['properties']['feature_type'] == "section": points = feat.geometry.coordinates list_of_points.extend(points) return {"latlng": list_of_points}
def Berkeley_pop_route(start_dt, end_dt): box = [[-122.267443, 37.864693], [-122.250985, 37.880687]] tl = esdt.get_aggregate_timeline_from_dt(start_dt, end_dt, box) gj_list = gfc.get_geojson_for_timeline(None, tl, viz=True) list_of_points = [] for gj in gj_list: for feature in gj: if feature['type'] == 'FeatureCollection': for feat in feature['features']: if "properties" not in feat: continue if feat['properties']['feature_type'] == "section": points = feat.geometry.coordinates list_of_points.extend(points) return {"latlng": list_of_points}
def Commute_pop_route(mode, start_dt, end_dt): tl = esdt.get_aggregate_timeline_from_dt(start_dt, end_dt) gj_list = gfc.get_geojson_for_timeline(None, tl, viz=True) logging.debug("len gl list is %d" % len(gj_list)) list_of_point=[] for gj in gj_list: for feature in gj: if feature['type'] == 'FeatureCollection': for feat in feature['features']: if "properties" not in feat: continue if feat['properties']['feature_type'] == "section": if mode == 'all' or feat.properties["sensed_mode"] == mode: points = feat.geometry.coordinates list_of_point.extend(points) logging.debug("Returning list of size %s" % len(list_of_point)) return {"latlng": list_of_point}
def Commute_pop_route(mode, start_dt, end_dt): tl = esdt.get_aggregate_timeline_from_dt(start_dt, end_dt) gj_list = gfc.get_geojson_for_timeline(None, tl, viz=True) logging.debug("len gl list is %d" % len(gj_list)) list_of_point = [] for gj in gj_list: for feature in gj: if feature['type'] == 'FeatureCollection': for feat in feature['features']: if "properties" not in feat: continue if feat['properties']['feature_type'] == "section": if mode == 'all' or feat.properties[ "sensed_mode"] == mode: points = feat.geometry.coordinates list_of_point.extend(points) logging.debug("Returning list of size %s" % len(list_of_point)) return {"latlng": list_of_point}