Beispiel #1
0
        /// <summary>
        /// generate all the features of all the data sources
        /// mode = 0, meterology data is found by knn; mode = 1, only find the stations' region
        /// </summary>
        public static void GenerateFeature(string roadNetworkFilename, string roadNetworkOutputFilename,
                                           string cityPOIFilename, string cityPOIOutputFilename,
                                           string roadMapFilename, string speedDirectory, string pickDropPointsDirectory, string mobilityOutputDirectory,
                                           string meterologyFilename, string stationLocationFilename, string meterologyFeatureDirectory,
                                           string airQualityFilename, string aqiFilename, string airStationFilename, string aqiFeatureDirectory, int mode)
        {
            RoadNetwork roadNetwork = IO.ReadRoadNetwork(roadNetworkFilename);
            CityPOI     cityPOI     = IO.ReadCityPOI(cityPOIFilename);

            #region Solution: just use the grid of the road network
            Grid grid = new Grid(roadNetwork.MinPoint, roadNetwork.MaxPoint, 0.015);
            #endregion

            #region roadnetwork feature
            roadNetwork.RoadFeatures(grid, roadNetworkOutputFilename);
            #endregion
            #region cityPOI
            cityPOI.CityPOIFeature(grid, cityPOIOutputFilename);
            #endregion
            #region totalMobility feature
            DirectoryInfo dirSpeed  = new DirectoryInfo(speedDirectory);
            FileInfo[]    files1    = dirSpeed.GetFiles();
            DirectoryInfo dirPoints = new DirectoryInfo(pickDropPointsDirectory);
            FileInfo[]    files2    = dirPoints.GetFiles();
            int           countDay  = files1.Count();

            for (int i = 0; i < countDay; i++)
            {
                Console.WriteLine(i + "day is readed.");
                using (ToTalMobility totalMobility = IO.ReadMobility(roadNetwork, roadMapFilename, files1[i].FullName, files2[i].FullName, files1[i].Name))
                {
                    totalMobility.TotalMobilityFeature(grid, mobilityOutputDirectory);
                }
            }
            #endregion
            #region meterology feature
            TotalMeterology totalMeterology = IO.ReadMeterology(meterologyFilename, stationLocationFilename);
            totalMeterology.TotalMeterologyFeature(grid, meterologyFeatureDirectory, mode);// mode = 0, meterology data is found by knn; mode = 1, only find the stations' region
            #endregion
            #region AQI label
            TotalAirQuality totalAirQuality = IO.ReadAirQuality(airQualityFilename, aqiFilename, airStationFilename);
            totalAirQuality.TotalAirQualityFeature(grid, aqiFeatureDirectory);
            #endregion
        }