Add OSM Track Harvesting Policy and demo database initialization script
- Updated documentation to include OSM Track Harvesting Policy with details on railway types, service filters, usage filters, and geometry guardrails. - Introduced a new script `init_demo_db.py` to automate the database setup process, including environment checks, running migrations, and loading OSM fixtures for demo data.
This commit is contained in:
@@ -76,17 +76,42 @@ STATION_TAG_FILTERS: Mapping[str, Tuple[str, ...]] = {
|
||||
|
||||
|
||||
# Tags that describe rail infrastructure usable for train routing.
|
||||
TRACK_ALLOWED_RAILWAY_TYPES: Tuple[str, ...] = (
|
||||
"rail",
|
||||
"light_rail",
|
||||
"subway",
|
||||
"tram",
|
||||
"narrow_gauge",
|
||||
"disused",
|
||||
"construction",
|
||||
)
|
||||
|
||||
|
||||
TRACK_TAG_FILTERS: Mapping[str, Tuple[str, ...]] = {
|
||||
"railway": (
|
||||
"rail",
|
||||
"light_rail",
|
||||
"subway",
|
||||
"tram",
|
||||
"narrow_gauge",
|
||||
),
|
||||
"railway": TRACK_ALLOWED_RAILWAY_TYPES,
|
||||
}
|
||||
|
||||
|
||||
# Track ingestion policy
|
||||
TRACK_EXCLUDED_SERVICE_TAGS: Tuple[str, ...] = (
|
||||
"yard",
|
||||
"siding",
|
||||
"spur",
|
||||
"crossover",
|
||||
"industrial",
|
||||
"military",
|
||||
)
|
||||
|
||||
TRACK_EXCLUDED_USAGE_TAGS: Tuple[str, ...] = (
|
||||
"military",
|
||||
"tourism",
|
||||
)
|
||||
|
||||
TRACK_MIN_LENGTH_METERS: float = 75.0
|
||||
|
||||
TRACK_STATION_SNAP_RADIUS_METERS: float = 350.0
|
||||
|
||||
|
||||
def compile_overpass_filters(filters: Mapping[str, Iterable[str]]) -> str:
|
||||
"""Build an Overpass boolean expression that matches the provided filters."""
|
||||
|
||||
@@ -101,6 +126,11 @@ __all__ = [
|
||||
"BoundingBox",
|
||||
"DEFAULT_REGIONS",
|
||||
"STATION_TAG_FILTERS",
|
||||
"TRACK_ALLOWED_RAILWAY_TYPES",
|
||||
"TRACK_TAG_FILTERS",
|
||||
"TRACK_EXCLUDED_SERVICE_TAGS",
|
||||
"TRACK_EXCLUDED_USAGE_TAGS",
|
||||
"TRACK_MIN_LENGTH_METERS",
|
||||
"TRACK_STATION_SNAP_RADIUS_METERS",
|
||||
"compile_overpass_filters",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user