Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pkg
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
[osr]
url=git@github.com:motis-project/osr.git
branch=master
commit=e0c3219fed5095f6ea0d8913d71286043a91f8b2
commit=fa8897b746ef8c64d42bbe83250ccdcf1e801152
[utl]
url=git@github.com:motis-project/utl.git
branch=master
commit=a63d8c1822293b8f18dc0418905c3c21067aa051
[adr]
url=git@github.com:triptix-tech/adr.git
branch=master
commit=c27f76c3220f0255adf9fb0ec4e68603846233fa
commit=9e5b5d6f93c68a1163cb1c876e0551a862c8efa4
[googletest]
url=git@github.com:motis-project/googletest.git
branch=master
Expand Down
10 changes: 5 additions & 5 deletions .pkg.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
1197569673745544009
3169187162594261322
cista 02fc087619fc913aca2c3fd3e07ec12279b8d6c6
zlib-ng d68e1d908e789c31c1f2fafe4bd8e09cb91e21c5
boost e54a8b5bf3bc2dc234c2992595eb95241979f45c
Expand All @@ -22,7 +22,9 @@ json ccc94522e752a13a0273dfb837ab36f7dbcda5ab
sqlite3 04e60de4ab15c5072b8c7ee2ac7335eb06f2588b
PROJ 27ed257526ddf6e2fd7a1a3c92a1d3de913ce34b
doctest 832431f2d9dc77e51cc8b364337c186660bf267d
geo d862550fd867cd5435225b5f0998981ec4fc2ae3
rtree.c 6ed73a7dc4f1184f2b5b2acd8ac1c2b28a273057
tg 20c0f298b8ce58de29a790290f44dca7c4ecc364
geo 3730d1fd47aa8c28a8f48898a4e3daa3c81dbac8
miniz e857234a23de8e5a2d05d266e518220a495db0ce
curl 0743359585cf0d2bd15b9792c0460470a231d8d0
opentelemetry-proto 1624689398a3226c45994d70cb544a1e781dc032
Expand All @@ -46,14 +48,12 @@ oneTBB cda5d37ce8303c58ac506259387e75de4ffcf26b
pbf-sdf-fonts 66f0c760272c7bdd0efeaac5aab5520b9194225e
variant 5aa73631dc969087c77433a5cdef246303051f69
tiles ef34f167440b934bdf2b5aab470eeb78240c23ac
rtree.c 6ed73a7dc4f1184f2b5b2acd8ac1c2b28a273057
osr e0c3219fed5095f6ea0d8913d71286043a91f8b2
prometheus-cpp e420cd7cf3995a994220b40a36c987ac8e67c0bf
reflect-cpp 86fdcdd09a54b0f55de97110e1911d27f60e498a
FTXUI dd6a5d371fd7a3e2937bb579955003c54b727233
Mustache 3f654942a70c46a775070d7a09ca7acfa3e205b7
address-formatting d08c98b5b2c57f51bf03cae6c4f6586edab23a5c
Nominatim c0c8a26c3915c928ff5fcc2a78e47e851603a06b
tg 20c0f298b8ce58de29a790290f44dca7c4ecc364
utf8proc 779b780da3b99d123133eb99707b65c7e4324cc8
adr c27f76c3220f0255adf9fb0ec4e68603846233fa
adr 9e5b5d6f93c68a1163cb1c876e0551a862c8efa4
5 changes: 4 additions & 1 deletion include/motis/adr_extend_tt.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

#include "date/tz.h"

#include "geo/area_db.h"

#include "nigiri/routing/clasz_mask.h"
#include "nigiri/types.h"

#include "adr/types.h"
#include "motis/fwd.h"
#include "motis/types.h"

Expand All @@ -28,7 +31,7 @@ date::time_zone const* get_tz(nigiri::timetable const&,
nigiri::location_idx_t);

adr_ext adr_extend_tt(nigiri::timetable const&,
adr::area_database const*,
geo::area_db_lookup<adr::area_idx_t> const*,
adr::typeahead&);

} // namespace motis
1 change: 0 additions & 1 deletion include/motis/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace adr {
struct formatter;
struct reverse;
struct area_database;
struct typeahead;
struct cache;
} // namespace adr
Expand Down
11 changes: 5 additions & 6 deletions src/adr_extend_tt.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "osr/geojson.h"

#include "motis/adr_extend_tt.h"

#include "nigiri/special_stations.h"
Expand All @@ -15,15 +13,13 @@

#include "nigiri/timetable.h"

#include "adr/area_database.h"
#include "adr/score.h"
#include "adr/typeahead.h"

#include "motis/types.h"

namespace a = adr;
namespace n = nigiri;
namespace json = boost::json;

namespace motis {

Expand Down Expand Up @@ -152,7 +148,7 @@ adr::score_t get_diff(std::string str1,
}

adr_ext adr_extend_tt(nigiri::timetable const& tt,
a::area_database const* area_db,
geo::area_db_lookup<adr::area_idx_t> const* area_db,
a::typeahead& t) {
if (tt.n_locations() == 0) {
return {};
Expand Down Expand Up @@ -447,7 +443,10 @@ adr_ext adr_extend_tt(nigiri::timetable const& tt,
if (area_db == nullptr) {
t.place_areas_.emplace_back(no_areas_idx);
} else {
area_db->lookup(t, a::coordinates::from_latlng(pos), areas);
area_db->lookup(a::coordinates::from_latlng(pos), areas);
utl::sort(areas, [&](adr::area_idx_t const a, adr::area_idx_t const b) {
return t.area_admin_level_[a] < t.area_admin_level_[b];
});
t.place_areas_.emplace_back(
utl::get_or_create(area_set_lookup, areas, [&]() {
auto const set_idx = a::area_set_idx_t{t.area_sets_.size()};
Expand Down
121 changes: 62 additions & 59 deletions src/import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "cista/io.h"

#include "adr/area_database.h"
#include "geo/area_db.h"

#include "utl/erase_if.h"
#include "utl/read_file.h"
Expand Down Expand Up @@ -42,7 +42,6 @@
#include "osr/ways.h"

#include "adr/adr.h"
#include "adr/area_database.h"
#include "adr/reverse.h"
#include "adr/typeahead.h"

Expand Down Expand Up @@ -368,63 +367,67 @@ data import(config const& c, fs::path const& data_path, bool const write) {
[&]() { d.load_tbd(); },
{tt_hash, n_version(), tbd_version()}};

auto adr_extend =
task{"adr_extend",
[&]() {
return c.timetable_.has_value() &&
(c.geocoding_ || c.reverse_geocoding_);
},
[&]() { return d.tt_.get() != nullptr; },
[&]() {
auto const area_db = d.t_ ? (std::optional<adr::area_database>{
std::in_place, data_path / "adr",
cista::mmap::protection::READ})
: std::nullopt;
if (!d.t_) {
d.t_ = cista::wrapped<adr::typeahead>{
cista::raw::make_unique<adr::typeahead>()};
}
auto const location_extra_place = adr_extend_tt(
*d.tt_, area_db.has_value() ? &*area_db : nullptr, *d.t_);
if (write) {
auto ec = std::error_code{};
std::filesystem::create_directories(data_path / "adr", ec);
cista::write(data_path / "adr" / "t_ext.bin", *d.t_);
cista::write(data_path / "adr" / "location_extra_place.bin",
location_extra_place);
}
d.r_.reset();
{
auto r = adr::reverse{data_path / "adr",
cista::mmap::protection::WRITE};
r.build_rtree(*d.t_);
r.write();
}
d.t_.reset();
if (c.geocoding_) {
d.load_geocoder();
}
if (c.reverse_geocoding_) {
d.load_reverse_geocoder();
}
},
[&]() {
d.t_.reset();
d.r_.reset();
if (c.geocoding_) {
d.load_geocoder();
}
if (c.reverse_geocoding_) {
d.load_reverse_geocoder();
}
},
{tt_hash,
osm_hash,
adr_version(),
adr_ext_version(),
n_version(),
{"geocoding", c.geocoding_},
{"reverse_geocoding", c.reverse_geocoding_}}};
auto adr_extend = task{
"adr_extend",
[&]() {
return c.timetable_.has_value() &&
(c.geocoding_ || c.reverse_geocoding_);
},
[&]() { return d.tt_.get() != nullptr; },
[&]() {
auto const area_db_storage =
d.t_ ? (std::optional<geo::area_db_storage<adr::area_idx_t>>{
std::in_place, data_path / "adr",
cista::mmap::protection::READ})
: std::nullopt;
auto const area_db_lookup = area_db_storage.and_then(
[](auto&& s) { return std::optional{geo::area_db_lookup{s}}; });
if (!d.t_) {
d.t_ = cista::wrapped<adr::typeahead>{
cista::raw::make_unique<adr::typeahead>()};
}
auto const location_extra_place = adr_extend_tt(
*d.tt_, area_db_lookup.has_value() ? &*area_db_lookup : nullptr,
*d.t_);
if (write) {
auto ec = std::error_code{};
std::filesystem::create_directories(data_path / "adr", ec);
cista::write(data_path / "adr" / "t_ext.bin", *d.t_);
cista::write(data_path / "adr" / "location_extra_place.bin",
location_extra_place);
}
d.r_.reset();
{
auto r =
adr::reverse{data_path / "adr", cista::mmap::protection::WRITE};
r.build_rtree(*d.t_);
r.write();
}
d.t_.reset();
if (c.geocoding_) {
d.load_geocoder();
}
if (c.reverse_geocoding_) {
d.load_reverse_geocoder();
}
},
[&]() {
d.t_.reset();
d.r_.reset();
if (c.geocoding_) {
d.load_geocoder();
}
if (c.reverse_geocoding_) {
d.load_reverse_geocoder();
}
},
{tt_hash,
osm_hash,
adr_version(),
adr_ext_version(),
n_version(),
{"geocoding", c.geocoding_},
{"reverse_geocoding", c.reverse_geocoding_}}};

auto osr_footpath_settings_hash =
meta_entry_t{"osr_footpath_settings", cista::BASE_HASH};
Expand Down
Loading