PostGIS: live — imports, spatiald, and fixes from real runs
Ran the full stack (docker now available via sg docker): - postgis/postgis:16-3.4 up, both extracts imported: northeast 291,000 POIs (from ~/osm-build/data/northeast.osm.pbf), colombia 228,446 POIs - spatiald live on :5005, proxied by the mock server (/spatial/*, /spatial-status); UI badge + poi_near tool activate automatically Fixes discovered by running against real data: - osm2pgsql image: osm2pgsql/osm2pgsql does not exist on Docker Hub — use iboates/osm2pgsql, bypass its DB-probing entrypoint (--entrypoint osm2pgsql), password via PGPASSWORD (this build's --password flag forces an interactive prompt) - osm2pgsql 2.x schema: planet_osm_point/_polygon (not _node/_way), geometry in EPSG:3857 'way' column, -k hstore for opening_hours/ fee/website/addr:*, refresh_poi() dedupes relation polygons and uses hstore -> (not ->>) - compose file downgraded to v1-compatible 3.8 (host has docker-compose 1.29, no v2 plugin); OSM_DIR exported by import.sh - spatiald: proper SQL parameterization (@@i@@ tokens, body .. shifted past the filter args — the first renumber attempt was unsound), ST_Distance(geography) instead of the geometry-only ST_Distance_Sphere, 4-arg ST_DWithin for the corridor band, WKT in lng lat order, kind= accepts exact (amenity=restaurant), bare tag value (restaurant) or family (tourism) - mock server /spatial proxy: forward u.search (was dropping it) - app.js poi_near: 'points' param, semicolons must be %3B-encoded (Go url.Parse drops the tail of a value containing a raw ';') - README: osm2pgsql 2.x data notes + kind semantics
This commit is contained in:
+1
-1
@@ -408,7 +408,7 @@ const TOOLS = {
|
||||
let qs = `lat=${lat}&lng=${lng}&r=${r}`;
|
||||
if (a.kind) qs += '&kind=' + encodeURIComponent(a.kind); // e.g. amenity=restaurant, tourism=museum
|
||||
if (a.name) qs += '&name=' + encodeURIComponent(a.name);
|
||||
if (a.corridor) qs += '&corridor=' + encodeURIComponent(a.corridor); // 'lng,lat;lng,lat;…' route polyline
|
||||
if (a.corridor) qs += '&points=' + encodeURIComponent(a.corridor); // 'lng,lat;lng,lat;…' route polyline (encoded: Go parses raw ';' as a param separator)
|
||||
const rj = await fetch('/spatial/' + (a.corridor ? 'corridor' : 'near') + '?' + qs);
|
||||
const j = await rj.json();
|
||||
if (j.error) return { error: j.error };
|
||||
|
||||
+1
-1
@@ -435,7 +435,7 @@ http.createServer((req, res) => {
|
||||
if (u.pathname === '/spatial-status' || u.pathname.startsWith('/spatial/')) {
|
||||
const up = u.pathname === '/spatial-status'
|
||||
? SPATIAL.url + '/health'
|
||||
: SPATIAL.url + u.pathname.slice('/spatial'.length); // keep query string
|
||||
: SPATIAL.url + u.pathname.slice('/spatial'.length) + (u.search || '');
|
||||
const isProbe = u.pathname === '/spatial-status';
|
||||
fetch(up, { signal: AbortSignal.timeout(15000) }).then(async r => {
|
||||
const t = await r.text();
|
||||
|
||||
Reference in New Issue
Block a user