From bc5c030a34f8d24d648eccc6d8ddeba09f297f39 Mon Sep 17 00:00:00 2001 From: Tom Johnell Date: Tue, 31 Mar 2026 14:13:34 -0500 Subject: [PATCH 1/2] Add park and dogPark POI categories Classify leisure=park and leisure=dog_park from OSM tags as new POI categories. Use a 1600m search radius (vs 800m standard) for these categories since parks tend to be larger and further from exit nodes. Co-Authored-By: Claude Opus 4.6 (1M context) --- schema/derive.sql | 7 ++++--- schema/osm2pgsql/openinterstate.lua | 7 +++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/schema/derive.sql b/schema/derive.sql index 4be2b01..de6a5cd 100644 --- a/schema/derive.sql +++ b/schema/derive.sql @@ -349,11 +349,12 @@ FROM ( ) AS rank FROM exits e JOIN pois p - ON p.geom && ST_Expand(e.geom, 0.012) - AND ST_DWithin(e.geom::geography, p.geom::geography, 800.0) + ON p.geom && ST_Expand(e.geom, 0.024) + AND ST_DWithin(e.geom::geography, p.geom::geography, + CASE WHEN p.category IN ('park', 'dogPark') THEN 1600.0 ELSE 800.0 END) WHERE p.category IS NOT NULL AND p.category <> 'restroom' - AND (p.category = 'restArea' OR LOWER(TRIM(COALESCE(NULLIF(p.display_name, ''), NULLIF(p.name, ''), 'Unknown'))) <> 'unknown') + AND (p.category IN ('restArea', 'park', 'dogPark') OR LOWER(TRIM(COALESCE(NULLIF(p.display_name, ''), NULLIF(p.name, ''), 'Unknown'))) <> 'unknown') AND NOT EXISTS ( SELECT 1 FROM exit_poi_reachability prior diff --git a/schema/osm2pgsql/openinterstate.lua b/schema/osm2pgsql/openinterstate.lua index 69f6c8d..b033370 100644 --- a/schema/osm2pgsql/openinterstate.lua +++ b/schema/osm2pgsql/openinterstate.lua @@ -49,6 +49,7 @@ local function classify_poi(tags) local tourism = tags.tourism or "" local highway = tags.highway or "" local shop = tags.shop or "" + local leisure = tags.leisure or "" if amenity == "fuel" or shop == "gas" then return "gas" @@ -68,6 +69,12 @@ local function classify_poi(tags) if amenity == "charging_station" then return "evCharging" end + if leisure == "dog_park" then + return "dogPark" + end + if leisure == "park" then + return "park" + end return nil end From 5b146d14b145fc87f21df370d945705f7083138b Mon Sep 17 00:00:00 2001 From: Tom Johnell Date: Tue, 31 Mar 2026 14:19:17 -0500 Subject: [PATCH 2/2] Fix bounding box envelope to be category-specific MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The expanded 0.024° envelope was applying to all categories, widening the initial candidate set unnecessarily. Now uses a CASE expression matching the ST_DWithin radius: 0.024° for park/dogPark, 0.012° for everything else. Co-Authored-By: Claude Opus 4.6 (1M context) --- schema/derive.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schema/derive.sql b/schema/derive.sql index de6a5cd..721770e 100644 --- a/schema/derive.sql +++ b/schema/derive.sql @@ -349,7 +349,8 @@ FROM ( ) AS rank FROM exits e JOIN pois p - ON p.geom && ST_Expand(e.geom, 0.024) + ON p.geom && ST_Expand(e.geom, + CASE WHEN p.category IN ('park', 'dogPark') THEN 0.024 ELSE 0.012 END) AND ST_DWithin(e.geom::geography, p.geom::geography, CASE WHEN p.category IN ('park', 'dogPark') THEN 1600.0 ELSE 800.0 END) WHERE p.category IS NOT NULL