diff --git a/Cargo.toml b/Cargo.toml index ab9aef840..cef5c2dd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] authors = ["Kisio Digital ", "Guillaume Pinot "] name = "transit_model" -version = "0.40.1" +version = "0.41.0" license = "AGPL-3.0-only" description = "Transit data management" repository = "https://github.com/CanalTP/transit_model" diff --git a/src/lib.rs b/src/lib.rs index 98f813ea3..af2f07ecd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,7 @@ mod version_utils; pub mod vptranslator; /// Current version of the NTFS format -pub const NTFS_VERSION: &str = "0.11.4"; +pub const NTFS_VERSION: &str = "0.12.0"; /// The max distance in meters to compute the transfer pub const TRANSFER_MAX_DISTANCE: &str = "300"; diff --git a/src/model.rs b/src/model.rs index e1ef16bdb..899190416 100644 --- a/src/model.rs +++ b/src/model.rs @@ -115,6 +115,7 @@ pub struct Collections { pub grid_exception_dates: Collection, pub grid_periods: Collection, pub grid_rel_calendar_line: Collection, + pub addresses: CollectionWithId
, } impl Collections { @@ -191,6 +192,7 @@ impl Collections { let mut level_id_used = HashSet::::new(); let mut calendars_used = HashSet::::new(); let mut vjs_used = HashSet::::new(); + let mut addresses_used = HashSet::::new(); let stop_point_id_to_old_idx = self.stop_points.get_id_to_idx().clone(); @@ -318,6 +320,9 @@ impl Collections { level_id_used.insert(level_id.clone()); } comments_used.extend(&mut sp.comment_links.iter().map(|cl| cl.to_string())); + if let Some(address_id) = &sp.address_id { + addresses_used.insert(address_id.clone()); + } true } else { log_object_removed("Stop Point", &sp.id); @@ -485,6 +490,8 @@ impl Collections { self.levels .retain(|level| level_id_used.contains(&level.id)); self.calendars.retain(|c| calendars_used.contains(&c.id)); + self.addresses + .retain(|address| addresses_used.contains(&address.id)); self.frequencies = dedup_collection(&mut self.frequencies); self.transfers = dedup_collection(&mut self.transfers); diff --git a/src/ntfs/mod.rs b/src/ntfs/mod.rs index 8bd21f2b6..5f6e74da4 100644 --- a/src/ntfs/mod.rs +++ b/src/ntfs/mod.rs @@ -129,6 +129,7 @@ struct Stop { equipment_id: Option, level_id: Option, platform_code: Option, + address_id: Option, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -264,6 +265,7 @@ where grid_exception_dates: make_opt_collection(file_handler, "grid_exception_dates.txt")?, grid_periods: make_opt_collection(file_handler, "grid_periods.txt")?, grid_rel_calendar_line: make_opt_collection(file_handler, "grid_rel_calendar_line.txt")?, + addresses: make_opt_collection_with_id(file_handler, "addresses.txt")?, ..Default::default() }; manage_calendars(file_handler, &mut collections)?; @@ -355,6 +357,7 @@ pub fn write>( write::write_fares_v1(path, model)?; write_collection_with_id(path, "pathways.txt", &model.pathways)?; write_collection_with_id(path, "levels.txt", &model.levels)?; + write_collection_with_id(path, "addresses.txt", &model.addresses)?; Ok(()) } @@ -382,7 +385,7 @@ mod tests { use super::*; use super::{read, write}; use crate::calendars::{manage_calendars, write_calendar_dates}; - use crate::objects::Availability; + use crate::objects; use crate::{read_utils::PathFileHandler, test_utils::*}; use geo::line_string; use pretty_assertions::assert_eq; @@ -462,7 +465,7 @@ mod tests { ("feed_end_date".to_string(), "20180131".to_string()), ("feed_publisher_name".to_string(), "Nicaragua".to_string()), ("feed_start_date".to_string(), "20180130".to_string()), - ("ntfs_version".to_string(), "0.11.4".to_string()), + ("ntfs_version".to_string(), "0.12.0".to_string()), ("tartare_platform".to_string(), "dev".to_string()), ], collections @@ -692,7 +695,7 @@ mod tests { trip_property_id: Some("0".to_string()), geometry_id: Some("Geometry:Line:Relation:6883353".to_string()), stop_times: vec![ - StopTime { + objects::StopTime { stop_point_idx: stop_points.get_idx("OIF:SP:36:2085").unwrap(), sequence: 0, arrival_time: Time::new(14, 40, 0), @@ -705,7 +708,7 @@ mod tests { local_zone_id: None, precision: Some(StopTimePrecision::Exact), }, - StopTime { + objects::StopTime { stop_point_idx: stop_points.get_idx("OIF:SP:36:2127").unwrap(), sequence: 1, arrival_time: Time::new(14, 42, 0), @@ -1140,7 +1143,7 @@ mod tests { company_id: "OIF:743".to_string(), trip_property_id: None, geometry_id: None, - stop_times: vec![StopTime { + stop_times: vec![objects::StopTime { stop_point_idx: stop_points.get_idx("sp_1").unwrap(), sequence: 0, arrival_time: Time::new(9, 0, 0), diff --git a/src/ntfs/read.rs b/src/ntfs/read.rs index c379479db..edf861e95 100644 --- a/src/ntfs/read.rs +++ b/src/ntfs/read.rs @@ -88,6 +88,7 @@ impl TryFrom for StopPoint { stop_type: stop.location_type.into(), platform_code: stop.platform_code, level_id: stop.level_id, + address_id: stop.address_id, ..Default::default() }; Ok(stop_point) diff --git a/src/ntfs/write.rs b/src/ntfs/write.rs index 4fe5fcbd5..c5d28898a 100644 --- a/src/ntfs/write.rs +++ b/src/ntfs/write.rs @@ -549,6 +549,7 @@ pub fn write_stops( geometry_id: sl.geometry_id.clone(), level_id: sl.level_id.clone(), platform_code: None, + address_id: None, })?; } Ok(()) @@ -579,6 +580,7 @@ pub fn write_stops( geometry_id: st.geometry_id.clone(), level_id: st.level_id.clone(), platform_code: st.platform_code.clone(), + address_id: st.address_id.clone(), }) .with_context(|_| format!("Error reading {:?}", path))?; } @@ -599,6 +601,7 @@ pub fn write_stops( geometry_id: sa.geometry_id.clone(), level_id: sa.level_id.clone(), platform_code: None, + address_id: None, }) .with_context(|_| format!("Error reading {:?}", path))?; } diff --git a/src/objects.rs b/src/objects.rs index added0951..9248236b9 100644 --- a/src/objects.rs +++ b/src/objects.rs @@ -1152,6 +1152,7 @@ pub struct StopPoint { pub platform_code: Option, #[serde(skip)] pub stop_type: StopType, + pub address_id: Option, } impl_id!(StopPoint); @@ -1174,6 +1175,10 @@ impl AddPrefix for StopPoint { .take() .map(|id| prefix_conf.referential_prefix(id.as_str())); self.comment_links.prefix(prefix_conf); + self.address_id = self + .address_id + .take() + .map(|id| prefix_conf.referential_prefix(id.as_str())); } } impl_codes!(StopPoint); @@ -1888,6 +1893,22 @@ impl AddPrefix for GridRelCalendarLine { } } +#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, Default)] +pub struct Address { + #[serde(rename = "address_id")] + pub id: String, + pub street_name: String, + pub house_number: Option, +} + +impl_id!(Address); + +impl AddPrefix for Address { + fn prefix(&mut self, prefix_conf: &PrefixConfiguration) { + self.id = prefix_conf.referential_prefix(self.id.as_str()); + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt b/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt index 42018b398..177877ffb 100644 --- a/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt +++ b/tests/fixtures/gtfs2ntfs/full_output/feed_infos.txt @@ -7,6 +7,6 @@ feed_license,DefaultDatasourceLicense feed_license_url,http://www.default-datasource-website.com feed_publisher_name,DefaultContributorName feed_start_date,20180101 -ntfs_version,0.11.4 +ntfs_version,0.12.0 tartare_contributor_id,DefaultContributorId tartare_platform,dev diff --git a/tests/fixtures/gtfs2ntfs/full_output/stops.txt b/tests/fixtures/gtfs2ntfs/full_output/stops.txt index e3f9796ee..08827bc30 100644 --- a/tests/fixtures/gtfs2ntfs/full_output/stops.txt +++ b/tests/fixtures/gtfs2ntfs/full_output/stops.txt @@ -1,17 +1,17 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -ME:stop:11,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,ME:WINTER:0,ME:1,A -ME:stop:22,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,, -ME:stop:31,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,, -ME:stop:32,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,, -ME:stop:33,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,, -ME:stop:51,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,, -ME:stop:52,pouet,,1,,2.372987,48.844746,0,ME:stoparea:3,,,,, -ME:stop:53,pouet,,1,,2.372987,48.844746,0,ME:stoparea:3,,,,, -ME:stop:61,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,, -ME:stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,, -ME:stoparea:3,small stop,,1,,2.372987,48.844746,1,,,,,, -ME:boarding:1,Boarding 1,,0,,2.37299,48.844749,5,ME:stop:11,,,,ME:1, -ME:boarding:2,Boarding 2,,0,,,,5,ME:stop:11,,,,ME:1, -ME:entrance:1,Entrance 1,,0,,2.372988,48.844747,3,ME:stoparea:1,,,,ME:0, -ME:node:1,Node 1,,0,,2.372989,48.844748,4,ME:stoparea:2,,,,ME:0, -ME:node:2,Node 2,,0,,,,4,ME:stoparea:2,,,,ME:0, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +ME:stop:11,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,ME:WINTER:0,ME:1,A, +ME:stop:22,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,,, +ME:stop:31,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,,, +ME:stop:32,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,,, +ME:stop:33,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,,, +ME:stop:51,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,,, +ME:stop:52,pouet,,1,,2.372987,48.844746,0,ME:stoparea:3,,,,,, +ME:stop:53,pouet,,1,,2.372987,48.844746,0,ME:stoparea:3,,,,,, +ME:stop:61,pouet,,1,,2.372987,48.844746,0,ME:stoparea:1,,,,,, +ME:stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,,, +ME:stoparea:3,small stop,,1,,2.372987,48.844746,1,,,,,,, +ME:boarding:1,Boarding 1,,0,,2.37299,48.844749,5,ME:stop:11,,,,ME:1,, +ME:boarding:2,Boarding 2,,0,,,,5,ME:stop:11,,,,ME:1,, +ME:entrance:1,Entrance 1,,0,,2.372988,48.844747,3,ME:stoparea:1,,,,ME:0,, +ME:node:1,Node 1,,0,,2.372989,48.844748,4,ME:stoparea:2,,,,ME:0,, +ME:node:2,Node 2,,0,,,,4,ME:stoparea:2,,,,ME:0,, diff --git a/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt b/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt index 67138039d..4f1fd391b 100644 --- a/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt +++ b/tests/fixtures/gtfs2ntfs/minimal/output/feed_infos.txt @@ -4,4 +4,4 @@ feed_creation_time,17:19:00 feed_creation_datetime,2019-04-03T17:19:00+00:00 feed_end_date,20180106 feed_start_date,20180101 -ntfs_version,0.11.4 +ntfs_version,0.12.0 diff --git a/tests/fixtures/gtfs2ntfs/minimal/output/stops.txt b/tests/fixtures/gtfs2ntfs/minimal/output/stops.txt index 9783258df..0b87e3712 100644 --- a/tests/fixtures/gtfs2ntfs/minimal/output/stops.txt +++ b/tests/fixtures/gtfs2ntfs/minimal/output/stops.txt @@ -1,11 +1,11 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -stop:11,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:22,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:31,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:32,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:33,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:51,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:52,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:53,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:61,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +stop:11,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:22,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:31,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:32,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:33,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:51,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:52,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:53,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:61,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,,, diff --git a/tests/fixtures/gtfs2ntfs/no_traffic/output/stops.txt b/tests/fixtures/gtfs2ntfs/no_traffic/output/stops.txt index 95ba1ada1..1a4b1c9f2 100644 --- a/tests/fixtures/gtfs2ntfs/no_traffic/output/stops.txt +++ b/tests/fixtures/gtfs2ntfs/no_traffic/output/stops.txt @@ -1,4 +1,4 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -stop:31,pouet,stopcode:31,1,,2.372987,48.844746,0,stoparea:1,,,,level2, -stop:33,pouet,stopcode:33,1,,2.372987,48.844746,0,stoparea:1,,,,level4, -stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,level1, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +stop:31,pouet,stopcode:31,1,,2.372987,48.844746,0,stoparea:1,,,,level2,, +stop:33,pouet,stopcode:33,1,,2.372987,48.844746,0,stoparea:1,,,,level4,, +stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,level1,, diff --git a/tests/fixtures/gtfs2ntfs/routes_comments/output/feed_infos.txt b/tests/fixtures/gtfs2ntfs/routes_comments/output/feed_infos.txt index 67138039d..4f1fd391b 100644 --- a/tests/fixtures/gtfs2ntfs/routes_comments/output/feed_infos.txt +++ b/tests/fixtures/gtfs2ntfs/routes_comments/output/feed_infos.txt @@ -4,4 +4,4 @@ feed_creation_time,17:19:00 feed_creation_datetime,2019-04-03T17:19:00+00:00 feed_end_date,20180106 feed_start_date,20180101 -ntfs_version,0.11.4 +ntfs_version,0.12.0 diff --git a/tests/fixtures/gtfs2ntfs/routes_comments/output/stops.txt b/tests/fixtures/gtfs2ntfs/routes_comments/output/stops.txt index 9783258df..0b87e3712 100644 --- a/tests/fixtures/gtfs2ntfs/routes_comments/output/stops.txt +++ b/tests/fixtures/gtfs2ntfs/routes_comments/output/stops.txt @@ -1,11 +1,11 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -stop:11,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:22,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:31,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:32,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:33,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:51,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:52,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:53,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:61,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +stop:11,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:22,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:31,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:32,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:33,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:51,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:52,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:53,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:61,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,,, diff --git a/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/feed_infos.txt b/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/feed_infos.txt index 67138039d..4f1fd391b 100644 --- a/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/feed_infos.txt +++ b/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/feed_infos.txt @@ -4,4 +4,4 @@ feed_creation_time,17:19:00 feed_creation_datetime,2019-04-03T17:19:00+00:00 feed_end_date,20180106 feed_start_date,20180101 -ntfs_version,0.11.4 +ntfs_version,0.12.0 diff --git a/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/stops.txt b/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/stops.txt index 9783258df..0b87e3712 100644 --- a/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/stops.txt +++ b/tests/fixtures/gtfs2ntfs/routes_comments/output_as_lines/stops.txt @@ -1,11 +1,11 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -stop:11,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:22,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:31,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:32,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:33,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:51,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:52,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:53,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stop:61,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,, -stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +stop:11,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:22,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:31,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:32,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:33,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:51,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:52,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:53,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stop:61,pouet,,1,,2.372987,48.844746,0,stoparea:1,,,,,, +stoparea:1,plop,,1,,2.372987,48.844746,1,,,,,,, diff --git a/tests/fixtures/minimal_ntfs/addresses.txt b/tests/fixtures/minimal_ntfs/addresses.txt new file mode 100644 index 000000000..9810ff477 --- /dev/null +++ b/tests/fixtures/minimal_ntfs/addresses.txt @@ -0,0 +1,5 @@ +address_id,street_name,house_number +1,rue de Bercy,Face au 9 +2,nation, +3,boulevard Montparnasse,23 +4,must be sanitized, diff --git a/tests/fixtures/minimal_ntfs/stops.txt b/tests/fixtures/minimal_ntfs/stops.txt index f18e94985..bd45d5795 100644 --- a/tests/fixtures/minimal_ntfs/stops.txt +++ b/tests/fixtures/minimal_ntfs/stops.txt @@ -1,19 +1,20 @@ -stop_id,stop_name,stop_lat,stop_lon,location_type,parent_station -GDL,Gare de Lyon,48.844746,2.372987,1, -GDLR,Gare de Lyon (RER),48.844746,2.372987,0,GDL -GDLM,Gare de Lyon (Metro),48.844746,2.372987,,GDL -GDLB,Gare de Lyon (Bus),48.844746,2.372987,,GDL -NAT,Nation,48.84849,2.396497,1, -NATR,Nation (RER),48.84849,2.396497,0,NAT -NATM,Nation (Metro),48.84849,2.396497,,NAT -CDG,Charles de Gaulle,48.873965,2.295354,1, -CDGR,Charles de Gaulle (RER),48.873965,2.295354,0,CDG -CDGM,Charles de Gaulle (Metro),48.973965,2.795354,,CDG -DEF,La Défense,48.891737,2.238964,1, -DEFR,La Défense (RER),48.891737,2.238964,0,DEF -CHA,Châtelet,48.858137,2.348145,1, -CHAM,Châtelet (Metro),48.858137,2.348145,0,CHA -MTP,Montparnasse,48.842481,2.321783,1, -MTPB,Montparnasse (Bus),48.842481,2.321783,0,MTP -MTPZ,Montparnasse Zone,48.842481,2.321783,2, -CDGZ,Charles de Gaulle Zone,48.842481,2.321783,2, +stop_id,stop_name,stop_lat,stop_lon,location_type,parent_station,address_id +GDL,Gare de Lyon,48.844746,2.372987,1,, +GDLR,Gare de Lyon (RER),48.844746,2.372987,0,GDL,1 +GDLM,Gare de Lyon (Metro),48.844746,2.372987,,GDL, +GDLB,Gare de Lyon (Bus),48.844746,2.372987,,GDL, +NAT,Nation,48.84849,2.396497,1,, +NATR,Nation (RER),48.84849,2.396497,0,NAT,2 +NATM,Nation (Metro),48.84849,2.396497,,NAT, +CDG,Charles de Gaulle,48.873965,2.295354,1,, +CDGR,Charles de Gaulle (RER),48.873965,2.295354,0,CDG, +CDGM,Charles de Gaulle (Metro),48.973965,2.795354,,CDG, +DEF,La Défense,48.891737,2.238964,1,, +DEFR,La Défense (RER),48.891737,2.238964,0,DEF, +CHA,Châtelet,48.858137,2.348145,1,, +CHAM,Châtelet (Metro),48.858137,2.348145,0,CHA, +MTP,Montparnasse,48.842481,2.321783,1,, +MTPB,Montparnasse (Bus),48.842481,2.321783,0,MTP,3 +MTPZ,Montparnasse Zone,48.842481,2.321783,2,, +CDGZ,Charles de Gaulle Zone,48.842481,2.321783,2,, +FOO,Sanitized,48.842481,2.321783,1,,,4 diff --git a/tests/fixtures/ntfs2ntfs/fares/stops.txt b/tests/fixtures/ntfs2ntfs/fares/stops.txt index 202229f71..d450404e7 100644 --- a/tests/fixtures/ntfs2ntfs/fares/stops.txt +++ b/tests/fixtures/ntfs2ntfs/fares/stops.txt @@ -1,6 +1,6 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -sp:1,Point 1,,1,,2.37,48.84,0,sa:1,,,,, -sp:2,Point 2,,1,,2.37,48.84,0,sa:1,,,,, -sp:4,Point 4,,1,,2.37,48.84,0,sa:2,,,,, -sa:1,Area 1,,1,,2.37,48.84,1,,,,,, -sa:2,Area 2,,1,,2.37,48.84,1,,,,,, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +sp:1,Point 1,,1,,2.37,48.84,0,sa:1,,,,,, +sp:2,Point 2,,1,,2.37,48.84,0,sa:1,,,,,, +sp:4,Point 4,,1,,2.37,48.84,0,sa:2,,,,,, +sa:1,Area 1,,1,,2.37,48.84,1,,,,,,, +sa:2,Area 2,,1,,2.37,48.84,1,,,,,,, diff --git a/tests/fixtures/ntfs2ntfs/platforms/stops.txt b/tests/fixtures/ntfs2ntfs/platforms/stops.txt index 897342d58..1f27048a8 100644 --- a/tests/fixtures/ntfs2ntfs/platforms/stops.txt +++ b/tests/fixtures/ntfs2ntfs/platforms/stops.txt @@ -1,6 +1,6 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -sp:1,Point 1,,1,,2.37,48.84,0,sa:1,,,,,A -sp:2,Point 2,,1,,2.37,48.84,0,sa:1,,,,,C -sp:4,Point 4,,1,,2.37,48.84,0,sa:2,,,,, -sa:1,Area 1,,1,,2.37,48.84,1,,,,,, -sa:2,Area 2,,1,,2.37,48.84,1,,,,,, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +sp:1,Point 1,,1,,2.37,48.84,0,sa:1,,,,,A, +sp:2,Point 2,,1,,2.37,48.84,0,sa:1,,,,,C, +sp:4,Point 4,,1,,2.37,48.84,0,sa:2,,,,,, +sa:1,Area 1,,1,,2.37,48.84,1,,,,,,, +sa:2,Area 2,,1,,2.37,48.84,1,,,,,,, diff --git a/tests/fixtures/ntfs2ntfs/stops/addresses.txt b/tests/fixtures/ntfs2ntfs/stops/addresses.txt new file mode 100644 index 000000000..48c7f1cb7 --- /dev/null +++ b/tests/fixtures/ntfs2ntfs/stops/addresses.txt @@ -0,0 +1,4 @@ +address_id,street_name,house_number +1,rue de Bercy,Face au 9 +2,nation, +3,boulevard Montparnasse,23 diff --git a/tests/fixtures/ntfs2ntfs/stops/stops.txt b/tests/fixtures/ntfs2ntfs/stops/stops.txt index 5415b1ebd..b293156a5 100644 --- a/tests/fixtures/ntfs2ntfs/stops/stops.txt +++ b/tests/fixtures/ntfs2ntfs/stops/stops.txt @@ -1,21 +1,21 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -GDLR,Gare de Lyon (RER),,1,,2.372987,48.844746,0,GDL,,,,, -GDLM,Gare de Lyon (Metro),,1,,2.372987,48.844746,0,GDL,,,,, -GDLB,Gare de Lyon (Bus),,1,,2.372987,48.844746,0,GDL,,,,, -NATR,Nation (RER),,1,,2.396497,48.84849,0,NAT,,,,, -NATM,Nation (Metro),,1,,2.396497,48.84849,0,NAT,,,,, -CDGR,Charles de Gaulle (RER),,1,,2.295354,48.873965,0,CDG,,,,, -CDGM,Charles de Gaulle (Metro),,1,,2.795354,48.973965,0,CDG,,,,, -DEFR,La Défense (RER),,1,,2.238964,48.891737,0,DEF,,,,, -CHAM,Châtelet (Metro),,1,,2.348145,48.858137,0,CHA,,,,, -MTPB,Montparnasse (Bus),,1,,2.321783,48.842481,0,MTP,,,,, -MTPZ,Montparnasse Zone,,1,,2.321783,48.842481,2,Navitia:MTPZ,,,,, -CDGZ,Charles de Gaulle Zone,,1,,2.321783,48.842481,2,Navitia:CDGZ,,,,, -GDL,Gare de Lyon,,1,,2.372987,48.844746,1,,,,,, -NAT,Nation,,1,,2.396497,48.84849,1,,,,,, -CDG,Charles de Gaulle,,1,,2.295354,48.873965,1,,,,,, -DEF,La Défense,,1,,2.238964,48.891737,1,,,,,, -CHA,Châtelet,,1,,2.348145,48.858137,1,,,,,, -MTP,Montparnasse,,1,,2.321783,48.842481,1,,,,,, -Navitia:MTPZ,Montparnasse Zone,,0,,2.321783,48.842481,1,,,,,, -Navitia:CDGZ,Charles de Gaulle Zone,,0,,2.321783,48.842481,1,,,,,, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +GDLR,Gare de Lyon (RER),,1,,2.372987,48.844746,0,GDL,,,,,,1 +GDLM,Gare de Lyon (Metro),,1,,2.372987,48.844746,0,GDL,,,,,, +GDLB,Gare de Lyon (Bus),,1,,2.372987,48.844746,0,GDL,,,,,, +NATR,Nation (RER),,1,,2.396497,48.84849,0,NAT,,,,,,2 +NATM,Nation (Metro),,1,,2.396497,48.84849,0,NAT,,,,,, +CDGR,Charles de Gaulle (RER),,1,,2.295354,48.873965,0,CDG,,,,,, +CDGM,Charles de Gaulle (Metro),,1,,2.795354,48.973965,0,CDG,,,,,, +DEFR,La Défense (RER),,1,,2.238964,48.891737,0,DEF,,,,,, +CHAM,Châtelet (Metro),,1,,2.348145,48.858137,0,CHA,,,,,, +MTPB,Montparnasse (Bus),,1,,2.321783,48.842481,0,MTP,,,,,,3 +MTPZ,Montparnasse Zone,,1,,2.321783,48.842481,2,Navitia:MTPZ,,,,,, +CDGZ,Charles de Gaulle Zone,,1,,2.321783,48.842481,2,Navitia:CDGZ,,,,,, +GDL,Gare de Lyon,,1,,2.372987,48.844746,1,,,,,,, +NAT,Nation,,1,,2.396497,48.84849,1,,,,,,, +CDG,Charles de Gaulle,,1,,2.295354,48.873965,1,,,,,,, +DEF,La Défense,,1,,2.238964,48.891737,1,,,,,,, +CHA,Châtelet,,1,,2.348145,48.858137,1,,,,,,, +MTP,Montparnasse,,1,,2.321783,48.842481,1,,,,,,, +Navitia:MTPZ,Montparnasse Zone,,0,,2.321783,48.842481,1,,,,,,, +Navitia:CDGZ,Charles de Gaulle Zone,,0,,2.321783,48.842481,1,,,,,,, diff --git a/tests/fixtures/restrict-validity-period/output/feed_infos.txt b/tests/fixtures/restrict-validity-period/output/feed_infos.txt index a4cae1d06..bd103e755 100644 --- a/tests/fixtures/restrict-validity-period/output/feed_infos.txt +++ b/tests/fixtures/restrict-validity-period/output/feed_infos.txt @@ -4,4 +4,4 @@ feed_creation_time,17:19:00 feed_creation_datetime,2019-04-03T17:19:00+00:00 feed_end_date,20180805 feed_start_date,20180501 -ntfs_version,0.11.4 +ntfs_version,0.12.0 diff --git a/tests/fixtures/restrict-validity-period/output/stops.txt b/tests/fixtures/restrict-validity-period/output/stops.txt index 8d5305ab8..2e6eea3f8 100644 --- a/tests/fixtures/restrict-validity-period/output/stops.txt +++ b/tests/fixtures/restrict-validity-period/output/stops.txt @@ -1,12 +1,12 @@ -stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code -GDLM,Gare de Lyon (Metro),,1,,2.372987,48.844746,0,GDL,,,eq:kept,, -GDLB,Gare de Lyon (Bus),,1,,2.372987,48.844746,0,GDL,,,,, -NATM,Nation (Metro),,1,,2.396497,48.84849,2,NAT,,geo:7:kept,,, -CDGM,Charles de Gaulle (Metro),,1,,2.795354,48.973965,0,CDG,,,,, -CHAM,Châtelet (Metro),,1,,2.348145,48.858137,0,CHA,,,,, -MTPB,Montparnasse (Bus),,1,,2.321783,48.842481,0,MTP,,,,, -GDL,Gare de Lyon,,1,,2.372987,48.844746,1,,,,,, -NAT,Nation,,1,,2.396497,48.84849,1,,,,,, -CDG,Charles de Gaulle,,1,,2.295354,48.873965,1,,,,,, -CHA,Châtelet,,1,,2.348145,48.858137,1,,,,,, -MTP,Montparnasse,,1,,2.321783,48.842481,1,,,,,, +stop_id,stop_name,stop_code,visible,fare_zone_id,stop_lon,stop_lat,location_type,parent_station,stop_timezone,geometry_id,equipment_id,level_id,platform_code,address_id +GDLM,Gare de Lyon (Metro),,1,,2.372987,48.844746,0,GDL,,,eq:kept,,, +GDLB,Gare de Lyon (Bus),,1,,2.372987,48.844746,0,GDL,,,,,, +NATM,Nation (Metro),,1,,2.396497,48.84849,2,NAT,,geo:7:kept,,,, +CDGM,Charles de Gaulle (Metro),,1,,2.795354,48.973965,0,CDG,,,,,, +CHAM,Châtelet (Metro),,1,,2.348145,48.858137,0,CHA,,,,,, +MTPB,Montparnasse (Bus),,1,,2.321783,48.842481,0,MTP,,,,,, +GDL,Gare de Lyon,,1,,2.372987,48.844746,1,,,,,,, +NAT,Nation,,1,,2.396497,48.84849,1,,,,,,, +CDG,Charles de Gaulle,,1,,2.295354,48.873965,1,,,,,,, +CHA,Châtelet,,1,,2.348145,48.858137,1,,,,,,, +MTP,Montparnasse,,1,,2.321783,48.842481,1,,,,,,, diff --git a/tests/read_ntfs.rs b/tests/read_ntfs.rs index 228af8936..c1d6809a3 100644 --- a/tests/read_ntfs.rs +++ b/tests/read_ntfs.rs @@ -142,7 +142,7 @@ fn ntfs_stops_output() { transit_model::ntfs::write(&ntm, output_dir, get_test_datetime()).unwrap(); compare_output_dir_with_expected( &output_dir, - Some(vec!["stops.txt", "stop_times.txt"]), + Some(vec!["stops.txt", "stop_times.txt", "addresses.txt"]), "tests/fixtures/ntfs2ntfs/stops", ); });