Skip to content

Repository files navigation

topografisk-gdb-api

OGC APIs for topographic geodata, built on geocomponents: datasets are described in YAML, and both the PostGIS schema and the per-dataset OGC API — Features services are generated from those descriptions.

System overview (Mermaid): ARCHITECTURE.md.

Repository layout

  • geocomponents/ — the engine. Start with its README for describing datasets and running locally; see DEPLOY.md for deployment.
  • gccore/ — a FastAPI service with Alembic-managed tables in the shared gc_core PostgreSQL schema.
  • gcjobs/ — a FastAPI service with Alembic-managed tables in the shared gc_jobs PostgreSQL schema.
  • gcimport/ — a profile-driven, single-endpoint FastAPI service that validates JSON-FG uploads and idempotently imports dataset features.
  • gcmapview/ — local Vite + React map viewer with an /import page for gcimport, editable Cadastre layers, and read-only Bane/Bygning layers on the map.
  • nibio/ NIBIO AR5 database dump and schema adjustments. Useful for Postgis Topology integration.

Development

The root Makefile provides shortcuts for the local compose stack, the frontend, and gcimport:

make docker-up         # Start the local compose stack: PostGIS, geocomponents, gcimport, gcmapview, gccore, and gcjobs
make docker-down       # Stop the local compose stack
make docker-delete-db-volume  # Delete the local geocomponents Postgres volume
make docker-trivy-scan # Build and Trivy-scan all Dockerfile-based services via Docker
make frontend-install  # Install frontend dependencies without running scripts
make frontend-build    # Build the frontend
make frontend-run      # Run the frontend development server
make frontend-lint     # Lint the frontend
make frontend-format   # Format the frontend
make gccore-install    # Install gccore dependencies
make gccore-test       # Run gccore tests
make gccore-run        # Run gccore on port 8002
make gcjobs-install    # Install gcjobs dependencies
make gcjobs-test       # Run gcjobs tests
make gcjobs-run        # Run gcjobs on port 8003
make gcimport-install  # Install gcimport dependencies
make gcimport-test     # Run gcimport tests
make gcimport-run      # Run gcimport on port 8001

To scan container images locally with the same Trivy severity filters as CI:

# Scan all Dockerfile-based services
make docker-trivy-scan

# Scan only one service image
make docker-trivy-scan SERVICE=gcimport

This runs Trivy inside Docker, so no local trivy install is required. It expects a working local Docker daemon and access to the Docker socket.

The repo uses pre-commit at the root to run various file-hygiene checks at commits. The same hooks run in CI (see .github/workflows/ci.yml).

pre-commit itself lives in the geocomponents dev dependency group, so uv is the only prerequisite:

# One-time setup: install the git hook and warm hook envs
uv sync --project geocomponents
uv run --project geocomponents pre-commit install

# Run against staged files (this is what the git hook does)
uv run --project geocomponents pre-commit run

# Run against every file in the repo (this is what CI does)
uv run --project geocomponents pre-commit run --all-files

For running the geocomponents test suite (unit tests without Docker, contract + integration tests against a local PostGIS), see geocomponents/README.md.

With make docker-up, the local ports are:

  • http://localhost:8000 for geocomponents
  • http://localhost:8001/docs for gcimport Swagger
  • http://localhost:8002/docs for gccore Swagger
  • http://localhost:8003/docs for gcjobs Swagger
  • http://localhost:8080 for gcmapview

The default import profile is bane; override it with ?profile=bygning for Bygning uploads. Example:

curl -F 'file=@bane.json;type=application/json' http://localhost:8001/imports

Technical details

We are currently using imresamu/postgis:17-3.6-alpine instead of the official postgis/postgis:17-3.6-alpine image for running locally as this resolves missing ARM64 compability in official image.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages