Lazy-load snaps visible in the current map viewport only

Open
#7 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
go
Domain
api, full-stack

Research direction

Start at the GET /snaps backend handler and the map code handling moveend or zoomend; inspect how entries and markers are currently loaded and stored. Add viewport bbox filtering and buffered marker updates, then verify that the endpoint returns only in-bounds snaps and the map refreshes correctly as the viewport changes.

Written by the indexing model from the issue text.

Description

enhancement performance ux

GET /snaps currently returns all snaps regardless of how many exist or what part of the map the user is viewing. With thousands of snaps this will become slow and memory-heavy on both server and client.

What needs to be done

Backend
  • Add a bounding-box query parameter to GET /snaps: ?bbox=minLng,minLat,maxLng,maxLat.
  • Only return snaps whose coordinates fall within the box.
  • Consider PostGIS (see related issue) for efficient spatial indexing; a plain WHERE latitude BETWEEN $1 AND $2 AND longitude BETWEEN $3 AND $4 index is a reasonable start.
Frontend
  • On map moveend / zoomend, compute the current viewport bounds (map.getBounds()) and re-fetch with the bbox parameter.
  • Merge new snaps into the existing entries map; remove markers that have scrolled out of an extended buffer zone (to avoid constant thrash at the edges).

Related

  • #8 PostGIS — proper spatial indexing
Dominant language
Go
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from williamokano/SentinelSnap

All issues in williamokano/SentinelSnap

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.