← back to Costa Rica
costa-rica: OSM Overpass fetch (3257 CR POIs) feeding cr-osm-match; $0 ODbL enrichment — TK-10346
aea4cf69d7cb300c6e6cefcb94a88cf592065811 · 2026-08-07 09:41:06 -0700 · Steve
Files touched
A scripts/data/cache/.gitignoreA scripts/ingest/osm-fetch.js
Diff
commit aea4cf69d7cb300c6e6cefcb94a88cf592065811
Author: Steve <steve@designerwallcoverings.com>
Date: Fri Aug 7 09:41:06 2026 -0700
costa-rica: OSM Overpass fetch (3257 CR POIs) feeding cr-osm-match; $0 ODbL enrichment — TK-10346
---
scripts/data/cache/.gitignore | 1 +
scripts/ingest/osm-fetch.js | 50 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+)
diff --git a/scripts/data/cache/.gitignore b/scripts/data/cache/.gitignore
new file mode 100644
index 0000000..a6c57f5
--- /dev/null
+++ b/scripts/data/cache/.gitignore
@@ -0,0 +1 @@
+*.json
diff --git a/scripts/ingest/osm-fetch.js b/scripts/ingest/osm-fetch.js
new file mode 100644
index 0000000..b35ea21
--- /dev/null
+++ b/scripts/ingest/osm-fetch.js
@@ -0,0 +1,50 @@
+'use strict';
+// Fetch all NAMED Costa Rica POIs that carry a website tag (and grab phone/geo
+// while we're there) from OpenStreetMap via Overpass. $0, ODbL-attribution.
+// Writes Overpass raw JSON (has .elements) to scripts/data/cache/osm-cr-websites.json,
+// which cr-osm-match.js consumes to fill website/phone/lat/lng on matching places.
+const fs = require('fs');
+const path = require('path');
+
+const OUT_DIR = path.join(__dirname, 'data', 'cache');
+const OUT = path.join(OUT_DIR, 'osm-cr-websites.json');
+const ENDPOINTS = [
+ 'https://overpass-api.de/api/interpreter',
+ 'https://overpass.kumi.systems/api/interpreter',
+ 'https://maps.mail.ru/osm/tools/overpass/api/interpreter',
+];
+// Named CR POIs with any website/phone/contact info — the useful enrichment set.
+const QUERY = `[out:json][timeout:300];
+area["ISO3166-1"="CR"][admin_level=2]->.cr;
+(
+ nwr(area.cr)["name"]["website"];
+ nwr(area.cr)["name"]["contact:website"];
+ nwr(area.cr)["name"]["phone"]["tourism"];
+ nwr(area.cr)["name"]["phone"]["amenity"~"restaurant|cafe|bar|hotel"];
+);
+out center tags;`;
+
+(async () => {
+ fs.mkdirSync(OUT_DIR, { recursive: true });
+ for (const ep of ENDPOINTS) {
+ try {
+ console.log(`[osm] trying ${ep}`);
+ const res = await fetch(ep, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded',
+ 'User-Agent': 'CR-Directory/1.0 (info@agentabrams.com)' },
+ body: 'data=' + encodeURIComponent(QUERY),
+ });
+ if (!res.ok) { console.log(`[osm] HTTP ${res.status}, next`); continue; }
+ const j = await res.json();
+ const n = (j.elements || []).length;
+ if (!n) { console.log('[osm] 0 elements, next endpoint'); continue; }
+ fs.writeFileSync(OUT, JSON.stringify(j));
+ console.log(`[osm] wrote ${n} elements → ${OUT}`);
+ process.exit(0);
+ } catch (e) {
+ console.log(`[osm] err ${String(e.message||e).slice(0,120)}, next`);
+ }
+ }
+ console.error('[osm] all endpoints failed'); process.exit(1);
+})();
← e747338 costa-rica: resumable Hacienda enrichment drain (25k cedulas
·
back to Costa Rica
·
costa-rica: payment layer — provider abstraction (Tilopay pr 2a36c95 →