kendrick-oppong/geoskills/geospatial-testing-strategy
Claude Code and agent skill by kendrick-oppong/geoskills
- community
Checking that the SKILL.md file is still in the repository.
Use when writing tests for geospatial code — geometry operation unit tests, floating-point tolerance in spatial assertions, testing CRS-handling logic, visual/snapshot testing of map rendering, and integration tests against a PostGIS test database.
Install
npx vskill@latest install kendrick-oppong/geoskills/geospatial-testing-strategySKILL.md
The same SKILL.md was published earlier as kendrick-oppong/geoskills/geospatial-testing-strategy.
Geospatial Testing Strategy
When to use this skill
- Writing unit/integration tests for anything doing geometry math, CRS transforms, or spatial queries
- Tests are flaky specifically around coordinate/geometry comparisons
- Deciding how to test map rendering output (styling, tile generation) without brittle pixel-perfect assertions
Core principles
Never assert exact floating-point equality on coordinates or geometry. Reprojection, geometry simplification, and even repeated serialization round-trips introduce tiny floating-point differences. Use a tolerance-based comparison (ST_Equals with a snap tolerance, or a numeric epsilon comparison on coordinates) instead of ===/exact equality.
Test CRS-handling logic explicitly and separately from business logic. A transform bug (axis order, wrong EPSG code) should fail a dedicated, obvious test — don't rely on it surfacing indirectly through a broader integration test where the failure mode is confusing.
Layer tests to match the architecture:
| Layer | Test approach | |
|---|---|---|
| Pure geometry functions (buffer, intersect, area calc) | Unit tests with known input/output geometries and known correct answers (compute expected values independently, don't just assert "doesn't throw") | |
| CRS transforms | Dedicated round-trip tests (A→B→A within tolerance) and known-good reference point tests (a landmark with a published exact coordinate in both CRSs) | |
| Database spatial queries (PostGIS) | Integration tests against a real (test/ephemeral) PostGIS instance — spatial index behavior and SQL correctness are hard to meaningfully unit-test without a real database engine | |
| Tile generation pipeline | Snapshot testing of generated tile content/feature counts per zoom level, rather than pixel-diffing rendered images (brittle against font/rendering-library version changes) | |
| Map rendering (visual) | Use sparingly — visual regression testing (e.g., comparing rendered map screenshots) is valuable for catching real style regressions but is inherently flaky across environments/GPU drivers; isolate it from the main CI-blocking test suite or use a generous diff tolerance |
Checklist
- [ ] Are geometry comparisons using a tolerance (
ST_DWithin/epsilon), not exact equality? - [ ] Do CRS transform tests include at least one independently-verifiable reference point (a known landmark's published coordinates), not only round-trip self-consistency (a bug that's consistently wrong in both directions would pass a pure round-trip test)?
- [ ] Are PostGIS-dependent tests run against a real ephemeral test database (e.g. a Dockerized Postgres+PostGIS instance in CI) rather than mocked, given how much spatial-query correctness depends on the actual engine?
- [ ] Is test data realistic in scale/complexity (real-world messy geometry with holes, multi-part features) rather than only trivial synthetic squares that don't exercise edge cases?
- [ ] Are visual/screenshot-based map tests isolated from the main fast test suite, with an explicitly generous tolerance, given cross-environment rendering variance?
- [ ] Is there a specific test for the antimeridian/pole edge cases if the application handles global data (per
global-crs-selection)? - [ ] Are performance regressions for spatial queries caught (e.g., a benchmark test asserting a known query stays under a latency budget) rather than only functional correctness?
Common pitfalls
- Exact floating-point assertions on transformed/processed coordinates: near-guaranteed flaky test failures across library versions/platforms — always use tolerance-based comparison.
- Mocking PostGIS spatial queries instead of testing against a real instance: spatial index behavior, SRID handling, and function semantics are genuinely engine-specific — a mock can pass while the real query is broken.
- Only testing "happy path" simple geometries (a single clean square polygon) and never testing multi-part geometries, geometries with holes, or geometries crossing the antimeridian — these are exactly where real bugs live.
- Pixel-perfect visual regression tests as CI gatekeepers: font rendering, GPU driver, and library version differences across CI runners cause noisy failures unrelated to real regressions — use generous tolerances or treat these as a separate, non-blocking check.
Related skills
geodata-qaqc— validating input data quality, distinct from testing code correctnesscrs-and-reprojection— the transform logic these tests targetpostgis-geospatial— the database layer integration tests run against
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/geospatial-testing-strategy/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kendrick-oppong/geoskills/geospatial-testing-strategy)