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 get_geojson_for_ts(user_id, start_ts, end_ts):
    tl = esdtl.get_cleaned_timeline(user_id, start_ts, end_ts)
    tl.fill_start_end_places()
    return get_geojson_for_timeline(user_id, tl)
Example #4
0
def get_geojson_for_ts(user_id, start_ts, end_ts):
    tl = esdtl.get_cleaned_timeline(user_id, start_ts, end_ts)
    tl.fill_start_end_places()
    return get_geojson_for_timeline(user_id, tl)