[Feature]: Reusable spatial indexing for map queries and snapping

Open
#2,330 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

Start with Map::hits_at and hits_in in crates/map/src/lib.rs, then read the snapping entry points in crates/engine/src/cmd/design.rs and related work in issues #818, #2051, #1065, and #2032. Decide how reusable indexes should be owned and kept valid across geometry, projection, and streamed-content changes while preserving feature and vertex identities. Done means a map-level query and snapping API handles the stated visibility, scale, filter, and exclusion rules; the issue provides no tests or benchmark criteria.

Written by the indexing model from the issue text.

Description

enhancement
Before you start
What problem does this solve?

Problem and proposal

Looking at main as of November 17, 2026 (cca86cb):

  • Map::hits_at and hits_in primarily iterate over loaded features.
  • Snapping scans feature vertices and segments, and its public entry points still require a Session.
  • The snapping path calls Geometry::extent(), which traverses coordinates to calculate the bounding box.

Relevant code: map queries, snapping.

Projection and some query results are cached, but continuous interaction with large layers or complex geometries may still incur substantial scanning costs. This is a source-level observation; I have not benchmarked these paths.

Could RustGIS provide a reusable spatial query/snapping API that works with an existing Map, independently of Session?

Ideally, it would:

  • Reuse indexes across queries, updating or invalidating them when geometry, projection, or streamed content changes.
  • Respect layer visibility, scale ranges, and feature filters.
  • Preserve source feature/vertex identities and snapping exclusion rules.
  • Handle both many features and individual geometries with many vertices efficiently.

Related work

RustGIS already has file-level and analysis indexes. This proposal focuses on map interaction:

  • #1119, #1148, #1928 added indexing to analysis and topology operations.
  • #818 and #2051 improved snapping identity handling and cache invalidation.
  • #1065 and #2032 track streamed rendering and per-layer coordinate systems, which this design should coordinate with.
Proposed solution

QGIS reference

QGIS separates these responsibilities into:

This is a reference for reusable APIs and ownership boundaries, not a request to copy a particular implementation.

Estimated scope

Medium: a broader feature that is feasible in a reasonable timeframe

Alternatives considered

No response

Dominant language
Rust
Stars
1.9k
Forks
268
Avg merge
11h 1m
Merged PRs (30d)
942

Getting set up

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 opengeos/RustGIS

All issues in opengeos/RustGIS

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.