SPB Git

Repository Public

07_places.sh 2.6 KB 58 lines shellscript

1#!/bin/bash2# =============================================================================3#                  SP BOUCHER | INFRASTRUCTURE & AUTOMATION4#             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project          : KA Maps Engine8# File             : server/pipeline/geo/07_places.sh9# Module           : server10# Repository       : https://git.spboucher.ai/ka-maps-engine11# Created          : 2026-12-0112# Last Modified    : 2026-12-0113#14# Author           : Simon-Pierre Boucher15# Position         : Professor of Finance16# Institution      : Université du Québec en Outaouais (UQO)17# Organization     : SP Boucher18# Website          : https://spboucher.ai19# Git              : https://git.spboucher.ai20#21# Preferred Contact: support@spboucher.ai22# Technical Contact: dev@spboucher.ai23# Security/Admin   : admin@spboucher.ai24#25# Copyright (c) 202626# Simon-Pierre Boucher27# All rights reserved where applicable. This file is governed by the28# applicable project license, copyright notices and relevant law.29# Existing third-party rights and notices remain unaffected.30#31# License          : None specified (no license file in this repository)32#33# Do not embed credentials, private keys, access tokens,34# certificates or confidential personal information.35#36# =============================================================================37# END OF SP BOUCHER SOURCE HEADER38# =============================================================================3940# KA Maps — lieux cherchables (municipalités, arrondissements, quartiers, MRC, régions, localités et points41# d'intérêt OSM), services de proximité et codes postaux → place, geo.amenity, geo.postcode.42set -euo pipefail43HERE=$(cd "$(dirname "$0")" && pwd); . "$HERE/env.sh"44KMGEO=${KMGEO:-$HERE/../../km-geo/target/release/km-geo}45W="$SRC/work"; mkdir -p "$W"46$PSQL -f "$HERE/07a_places.sql"47$PSQL -Atc "SELECT DISTINCT name FROM place WHERE name !~ E'[\\t\\n\\r]'" > "$W/pnames.txt"48"$KMGEO" norm < "$W/pnames.txt" > "$W/pnames.tsv"49$PSQL <<SQL50CREATE TEMP TABLE pn (name text, norm text, core text);51\\copy pn FROM '$W/pnames.tsv' WITH (FORMAT csv, DELIMITER E'\\t', QUOTE E'\\b')52INSERT INTO name_norm SELECT DISTINCT ON (name) name, norm, coalesce(core, norm) FROM pn WHERE norm IS NOT NULL ON CONFLICT (name) DO NOTHING;53SQL54$PSQL -f "$HERE/07b_index.sql"55# Codes postaux : seulement dans une reconstruction complète (ils dépendent des adresses).56if [ "${GEO_MODE:-full}" = full ]; then $PSQL -f "$HERE/07c_postcode.sql"; fi57echo PLACES_DONE58
Files main
Menu

Theme