Skip to content

Latest commit

 

History

History

README.md

gcmapview

A small Vite + React map viewer for the geocomponents OGC API, plus a JSON-FG upload page that starts imports through gcjobs.

Note that this is a small viewer for developer testing, it is not targeted for wide deployment.

Routes

  • / — map with editable Cadastre layers plus read-only FKB-Bane and Bygning layers
  • /import — upload a JSON-FG or classic GeoJSON FeatureCollection to gcjobs; the UI auto-detects FKB-Bane vs Bygning when possible, and still lets the user override the profile

Current read-only import-backed layers on the map:

  • FKB-Bane: jernbaneplattformkant, spormidt
  • Bygning: bygning, bygning_omrade, bygning_senterlinje, bygning_posisjon

In local development and Docker Compose, the browser talks directly to:

  • http://localhost:8000 for geocomponents
  • http://localhost:8003 for gcjobs import start and status APIs

Run

Start the local backend stack (for example with make docker-up), then:

npm install
npm run dev

Optional overrides:

GEOCOMPONENTS_API_URL=http://localhost:8000 \
GCJOBS_API_URL=http://localhost:8003 \
npm run dev

Those variables are required inputs for the frontend runtime. In local development, set them to the exposed backend ports. In containerized or deployed environments, set them to the addresses the browser should call.

Docker

make docker-up also starts a containerized gcmapview at http://localhost:8080.

Inside Docker, a small read-only Node server serves the built app, falls back to index.html for client-side routes, and renders /runtime-config.js directly from environment variables without writing into the container filesystem. API calls still go directly from the browser to the exposed backend addresses.

To make the browser call public API addresses directly in a deployed environment, set these optional runtime variables instead:

GEOCOMPONENTS_API_URL=https://geocomponents.example.no
GCJOBS_API_URL=https://gcjobs.example.no

When set, gcmapview uses those absolute URLs in the browser and bypasses the Nginx container for API requests. The target APIs must allow the frontend origin with CORS for this mode to work.

For Docker Compose, gcmapview uses these direct browser URLs by default:

GEOCOMPONENTS_API_URL=http://localhost:8000
GCJOBS_API_URL=http://localhost:8003

The container does not provide built-in fallback values for these. If they are missing, startup fails fast.

The image is compatible with a read-only root filesystem because it does not rewrite web-server config or emit runtime assets during startup.

For Kubernetes or another deployed environment, point these at public API addresses instead, for example:

env:
  - name: GEOCOMPONENTS_API_URL
    value: https://geocomponents.example.no
  - name: GCJOBS_API_URL
    value: https://gcjobs.example.no

geocomponents and gcjobs must allow the gcmapview origin through CORS. The local compose file sets that up for http://localhost:5173 and http://localhost:8080.

This is separate from the internal gcjobs -> gcimport -> geocomponents service configuration. Inside the backend containers, internal service URLs should still point at cluster or Compose service names. Only gcmapview should use public browser-facing URLs.