Skip to content

feat(heatmap): Add outings map density endpoints (heatmap + tracks) - #2231

Open
Nayor wants to merge 1 commit into
masterfrom
feature/outings-heatmap
Open

Nayor wants to merge 1 commit into
masterfrom
feature/outings-heatmap

Conversation

@Nayor

@Nayor Nayor commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New GET /outings/map/heatmap endpoint: PostGIS grid aggregation (ST_SnapToGrid) of outings for a bbox, filterable by activity, meant to feed a density heatmap at low/medium map zoom.
  • New GET /outings/map/tracks endpoint: individual outing tracks (geom_detail) intersecting a bbox, filterable by activity, capped at 100 results with an explicit truncated flag rather than a silent partial list — meant to feed a vector layer once the map is zoomed in enough for the outing count to stay bounded.
  • Both query PostGIS directly rather than Elasticsearch, since geom_detail tracks only exist there and ST_Intersects on the real track is more correct than the existing centroid-only bbox= filter.
  • Reuses the existing dogpile/Redis caching idiom (new cache_outing_map region).

Related: c2corg/c2c_ui#4573 (frontend counterpart), c2corg/c2c_ui#4573 has the community forum context behind this feature.

Test plan

  • New unit tests in c2corg_api/tests/views/test_outing_map.py (bbox/zoom/activity validation, heatmap bucket counts, tracks list + activity filter + truncation) — all passing.
  • Full existing test suite run for regressions — pre-existing failures unrelated to this change (a collections.Mapping Python 3.12 incompatibility already tracked by the separate python-3.12-migration branch); none touch the new files.
  • Manual curl smoke test against a dev instance recommended before merge.

🤖 Generated with Claude Code

@codacy-production

codacy-production Bot commented Sep 12, 2026

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 21 minor

Alerts:
⚠ 21 issues (≤ 0 issues of at least minor severity)

Results:
21 new issues

Category Results
Documentation 21 minor

View in Codacy

🟢 Metrics 50 complexity · 2 duplication

Metric Results
Complexity 50
Duplication 2

View in Codacy

🟢 Coverage 96.86% diff coverage · +0.04% coverage variation

Metric Results
Coverage variation +0.04% coverage variation
Diff coverage 96.86% diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (9e1cdfb) 21972 20303 92.40%
Head commit (7a4e43f) 22163 (+191) 20488 (+185) 92.44% (+0.04%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#2231) 191 185 96.86%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@Nayor Nayor changed the title Add outings map density endpoints (heatmap + tracks) feat(heatmap): Add outings map density endpoints (heatmap + tracks) Sep 12, 2026
@Nayor Nayor self-assigned this Sep 13, 2026
Two new endpoints back the outings search map's density feature:
GET /outings/map/heatmap aggregates outings into a PostGIS grid
(ST_SnapToGrid) for low/medium zoom levels, and GET /outings/map/tracks
returns individual outing tracks for a bbox once zoomed in enough for
the result count to stay bounded. Both query PostGIS directly (not
Elasticsearch) since geom_detail tracks only exist there, and reuse the
existing dogpile/Redis caching idiom.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@Nayor
Nayor force-pushed the feature/outings-heatmap branch from 4aaf255 to 7a4e43f Compare September 13, 2026 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant