Skip to content

Commit

Permalink
Correctif suite à réimport BDTOPO (#1050)
Browse files Browse the repository at this point in the history
  • Loading branch information
florimondmanca authored Nov 4, 2024
1 parent b78f180 commit 03cf541
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private function provideTestComputeRoadLine(): array
'standard' => [
'roadName' => 'Rue de Famars',
'inseeCode' => '59606', // Valenciennes
'geometry' => '{"type":"MultiLineString","coordinates":[[[3.521789594,50.354739626],[3.521764707,50.354775643],[3.521598673,50.355004387],[3.521507319,50.355126875]],[[3.521464982,50.355375745],[3.521433481,50.355314828]],[[3.522862085,50.352877527],[3.522829301,50.352963855],[3.522741262,50.353134812]],[[3.523000274,50.352264637],[3.522940617,50.352465999],[3.522934214,50.352525281],[3.522935218,50.35262224]],[[3.52235843,50.356688146],[3.522243056,50.356523439],[3.522150571,50.356400831],[3.522082435,50.356325704],[3.521979012,50.356230975],[3.521923783,50.356182727],[3.521851614,50.356124675]],[[3.522631994,50.357222078],[3.522606363,50.357186275],[3.522603315,50.357162945],[3.522634011,50.357145757],[3.522629615,50.357127819],[3.522454698,50.356905007]],[[3.522454698,50.356905007],[3.522376207,50.356778749],[3.522382825,50.356740116],[3.52235843,50.356688146]],[[3.521507319,50.355126875],[3.521433481,50.355314828]],[[3.522935218,50.35262224],[3.522936816,50.352641087],[3.522922171,50.352717463],[3.522862085,50.352877527]],[[3.522232905,50.354048237],[3.52215435,50.354186831],[3.522034181,50.354372287]],[[3.521851614,50.356124675],[3.521786581,50.356078264],[3.521725582,50.356014778],[3.521658859,50.355940542],[3.521614653,50.355872496],[3.521568534,50.355755079],[3.521531599,50.355575674],[3.52150244,50.355469857],[3.521464982,50.355375745]],[[3.522741262,50.353134812],[3.522596769,50.353410152],[3.52235284,50.353840336]],[[3.52235284,50.353840336],[3.522289434,50.353951035],[3.522232905,50.354048237]],[[3.522034181,50.354372287],[3.521887767,50.354598256],[3.521789594,50.354739626]]]}',
'geometry' => '{"type":"MultiLineString","coordinates":[[[3.521789594,50.354739626],[3.521764707,50.354775643],[3.521598673,50.355004387],[3.521507319,50.355126875]],[[3.521464982,50.355375745],[3.521433481,50.355314828]],[[3.522862085,50.352877527],[3.522829301,50.352963855],[3.522741262,50.353134812]],[[3.523000274,50.352264637],[3.522940617,50.352465999],[3.522934214,50.352525281],[3.522935218,50.35262224]],[[3.52235843,50.356688146],[3.522243056,50.356523439],[3.522150571,50.356400831],[3.522082435,50.356325704],[3.521979012,50.356230975],[3.521923783,50.356182727],[3.521851614,50.356124675]],[[3.522631994,50.357222078],[3.522606363,50.357186275],[3.522603315,50.357162945],[3.522634011,50.357145757],[3.522629615,50.357127819],[3.522454698,50.356905007]],[[3.522454698,50.356905007],[3.522376207,50.356778749],[3.522382825,50.356740116],[3.52235843,50.356688146]],[[3.522741262,50.353134812],[3.522596769,50.353410152],[3.52235284,50.353840336]],[[3.521507319,50.355126875],[3.521433481,50.355314828]],[[3.522935218,50.35262224],[3.522936816,50.352641087],[3.522922171,50.352717463],[3.522862085,50.352877527]],[[3.522232905,50.354048237],[3.52215435,50.354186831],[3.522034181,50.354372287]],[[3.521851614,50.356124675],[3.521786581,50.356078264],[3.521725582,50.356014778],[3.521658859,50.355940542],[3.521614653,50.355872496],[3.521568534,50.355755079],[3.521531599,50.355575674],[3.52150244,50.355469857],[3.521464982,50.355375745]],[[3.52235284,50.353840336],[3.522289434,50.353951035],[3.522232905,50.354048237]],[[3.522034181,50.354372287],[3.521887767,50.354598256],[3.521789594,50.354739626]]]}',
],
'normalize_hyphen' => [
'roadName' => 'rue sainte-catherine',
Expand Down Expand Up @@ -232,6 +232,13 @@ private function provideTestFindRoadNames(): array
'Rue De L\'Église',
],
],
'la_reunion' => [
'villèle',
'97410',
[
'Rue Auguste De Villèle',
],
],
];
}

Expand Down Expand Up @@ -320,14 +327,13 @@ public function testFindSectionsInArea(): void
// By default all types of sections are included.
$geometry = $this->roadGeocoder->findSectionsInArea($area);
$this->assertSame(
'{"type":"MultiLineString","coordinates":[[[2.704663706,49.375064848],[2.705508168,49.374958144],[2.706102966,49.374938917],[2.706678394,49.374936719],[2.707757531,49.37495641]],[[2.704047618,49.379991827],[2.704002207,49.37998812],[2.703927917,49.37997895],[2.703874323,49.37996174],[2.703838642,49.379941878],[2.703823638,49.379917572],[2.703819668,49.379889697],[2.703829635,49.379832194],[2.703868123,49.379603078],[2.703908085,49.379356887],[2.704045651,49.378176115],[2.704074021,49.377790571],[2.704148908,49.377215479],[2.704347775,49.376145415],[2.70449489,49.375697239],[2.704644914,49.375221205],[2.704661989,49.375124169],[2.704663706,49.375064848]],[[2.703931583,49.375025305],[2.703972588,49.373877549],[2.703977585,49.373726551],[2.703973356,49.373024523],[2.703911925,49.368140794]],[[2.702812091,49.375080986],[2.703003456,49.37507786],[2.703226487,49.375073913],[2.703234746,49.375073934],[2.703444002,49.37507175],[2.703720699,49.37507153],[2.703928546,49.375074735],[2.704122628,49.375077907],[2.70422448,49.375080853],[2.704291927,49.375081917],[2.704411689,49.375082209],[2.704450238,49.375081405],[2.704547996,49.375078048],[2.704663706,49.375064848]],[[2.704141355,49.370375059],[2.704154607,49.371424076],[2.704175827,49.373723441],[2.704157915,49.374446088],[2.704127042,49.37502848]],[[2.704119365,49.375166887],[2.70408568,49.375759159],[2.703941665,49.37710531],[2.70390435,49.377370385]],[[2.704127042,49.37502848],[2.704124118,49.375058136],[2.704122628,49.375077907],[2.704119365,49.375166887]],[[2.703926664,49.37516282],[2.703928546,49.375074735],[2.703931583,49.375025305]],[[2.703813123,49.376475788],[2.703820301,49.376424571],[2.703926664,49.37516282]]]}',
$geometry,
'{"type":"MultiLineString","coordinates":[[[2.703926664,49.37516282],[2.703928546,49.375074735],[2.703931583,49.375025305]],[[2.703813123,49.376475788],[2.703820301,49.376424571],[2.703926664,49.37516282]],[[2.704119365,49.375166887],[2.70408568,49.375759159],[2.703941665,49.37710531],[2.70390435,49.377370385]],[[2.704127042,49.37502848],[2.704124118,49.375058136],[2.704122628,49.375077907],[2.704119365,49.375166887]],[[2.704047618,49.379991827],[2.704002207,49.37998812],[2.703927917,49.37997895],[2.703874323,49.37996174],[2.703838642,49.379941878],[2.703823638,49.379917572],[2.703819668,49.379889697],[2.703829635,49.379832194],[2.703868123,49.379603078],[2.703908085,49.379356887],[2.704045651,49.378176115],[2.704074021,49.377790571],[2.704148908,49.377215479],[2.704347775,49.376145415],[2.70449489,49.375697239],[2.704644914,49.375221205],[2.704661989,49.375124169],[2.704663706,49.375064848]],[[2.702812091,49.375080986],[2.703003456,49.37507786],[2.703226487,49.375073913],[2.703234746,49.375073934],[2.703444002,49.37507175],[2.703720699,49.37507153],[2.703928546,49.375074735],[2.704122628,49.375077907],[2.70422448,49.375080853],[2.704291927,49.375081917],[2.704411689,49.375082209],[2.704450238,49.375081405],[2.704547996,49.375078048],[2.704663706,49.375064848]],[[2.704663706,49.375064848],[2.705508168,49.374958144],[2.706102966,49.374938917],[2.706678394,49.374936719],[2.707757531,49.37495641]],[[2.703931583,49.375025305],[2.703972588,49.373877549],[2.703977585,49.373726551],[2.703973356,49.373024523],[2.703911925,49.368140794]],[[2.704141355,49.370375059],[2.704154607,49.371424076],[2.704175827,49.373723441],[2.704157915,49.374446088],[2.704127042,49.37502848]]]}', $geometry,
);

// When excluding highways, the result contains only Rue de Vaudherlant and the "bretelle".
$geometry = $this->roadGeocoder->findSectionsInArea($area, excludeTypes: [$this->roadGeocoder::HIGHWAY]);
$this->assertSame(
'{"type":"MultiLineString","coordinates":[[[2.704663706,49.375064848],[2.705508168,49.374958144],[2.706102966,49.374938917],[2.706678394,49.374936719],[2.707757531,49.37495641]],[[2.704047618,49.379991827],[2.704002207,49.37998812],[2.703927917,49.37997895],[2.703874323,49.37996174],[2.703838642,49.379941878],[2.703823638,49.379917572],[2.703819668,49.379889697],[2.703829635,49.379832194],[2.703868123,49.379603078],[2.703908085,49.379356887],[2.704045651,49.378176115],[2.704074021,49.377790571],[2.704148908,49.377215479],[2.704347775,49.376145415],[2.70449489,49.375697239],[2.704644914,49.375221205],[2.704661989,49.375124169],[2.704663706,49.375064848]],[[2.702812091,49.375080986],[2.703003456,49.37507786],[2.703226487,49.375073913],[2.703234746,49.375073934],[2.703444002,49.37507175],[2.703720699,49.37507153],[2.703928546,49.375074735],[2.704122628,49.375077907],[2.70422448,49.375080853],[2.704291927,49.375081917],[2.704411689,49.375082209],[2.704450238,49.375081405],[2.704547996,49.375078048],[2.704663706,49.375064848]]]}',
'{"type":"MultiLineString","coordinates":[[[2.704047618,49.379991827],[2.704002207,49.37998812],[2.703927917,49.37997895],[2.703874323,49.37996174],[2.703838642,49.379941878],[2.703823638,49.379917572],[2.703819668,49.379889697],[2.703829635,49.379832194],[2.703868123,49.379603078],[2.703908085,49.379356887],[2.704045651,49.378176115],[2.704074021,49.377790571],[2.704148908,49.377215479],[2.704347775,49.376145415],[2.70449489,49.375697239],[2.704644914,49.375221205],[2.704661989,49.375124169],[2.704663706,49.375064848]],[[2.702812091,49.375080986],[2.703003456,49.37507786],[2.703226487,49.375073913],[2.703234746,49.375073934],[2.703444002,49.37507175],[2.703720699,49.37507153],[2.703928546,49.375074735],[2.704122628,49.375077907],[2.70422448,49.375080853],[2.704291927,49.375081917],[2.704411689,49.375082209],[2.704450238,49.375081405],[2.704547996,49.375078048],[2.704663706,49.375064848]],[[2.704663706,49.375064848],[2.705508168,49.374958144],[2.706102966,49.374938917],[2.706678394,49.374936719],[2.707757531,49.37495641]]]}',
$geometry,
);
}
Expand Down
4 changes: 2 additions & 2 deletions tools/bdtopo_update
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def main(
print(f"ERROR: directory {directory} does not exist", file=sys.stderr)
return 1

search_pattern = "*/BDTOPO/1_DONNEES_LIVRAISON_*/*/TRANSPORT/*"
search_pattern = "**/1_DONNEES_LIVRAISON_*/*/TRANSPORT/*.gpkg"

tables_by_name = {table.name: table for table in config.tables}
geopackages = []
Expand Down Expand Up @@ -201,7 +201,7 @@ def main(
"FID=ogc_fid",
]

if table.name not in tables_seen:
if overwrite and table.name not in tables_seen:
options.extend(
[
# Remove existing tuples before importing (saves disk space
Expand Down

0 comments on commit 03cf541

Please sign in to comment.