π«π· Lire ceci en franΓ§ais
This guide is for the one-click GitHub Codespaces test instance. It explains how to author a QGIS project on your computer and publish it to your online Lizmap, including the case where your data lives in the bundled PostGIS database.
Your Codespace ships with an empty My projects repository ready to receive your project.
-
QGIS Desktop with the Lizmap plugin installed.
-
VS Code Desktop (free). Once your Codespace is open in the browser, click Open in VS Code Desktop (top-left menu, or the green "Code" button on the repo). Sign in with your GitHub account when prompted β no separate password, no command line.
Prefer the terminal? Everything below (uploading files, reaching PostGIS) also works with the GitHub CLI (
gh) instead of VS Code Desktop β see the tips at the end of each step.
If your layers are in a GeoPackage (or Shapefileβ¦), just keep the data file in the same
folder as your .qgs and use relative paths in QGIS. Nothing else to do β QGIS Server reads
the file directly. Skip to step 2.
The stack already runs a PostGIS database; QGIS Server reads it through the pg_service
named lizmap_local. The trick is to use that same service name on your desktop, so the
exact same .qgs works on your machine and on the server with no edit.
-
Open a tunnel to the Codespace database. In VS Code Desktop, open the Ports tab (bottom panel) β Forward a Port β type
8093β Enter. PostGIS is now reachable atlocalhost:8093on your machine β no popup, no extra install, it just works because VS Code Desktop tunnels ports to your reallocalhost.π‘ Raw database connections only work through a desktop tool (VS Code Desktop above, or
gh codespace ports forward 8093:8093in a terminal β the format is<remote-port>:<local-port>, so both sides must be8093to match thepg_service.confbelow) β the publichttps://...app.github.devport URL only proxies HTTP(S) and cannot carry the Postgres protocol. -
Declare the
lizmap_localservice on your computer. Add this to your pg_service file (~/.pg_service.confon Linux/macOS,%APPDATA%\postgresql\.pg_service.confon Windows):[lizmap_local] host=localhost port=8093 dbname=lizmap user=lizmap password=lizmap1234!
-
In QGIS β Data Source Manager β PostgreSQL β New, set Service =
lizmap_local(leave Host/Port empty) and Test Connection. Using the Service field is what makes QGIS writeservice='lizmap_local'into the project instead of a hard-coded host β essential for the project to resolve on the server. -
Load your data into the database (schema
lizmap, or create your own). For example with QGIS DB Manager (Import layer), or from a terminal:ogr2ogr -f PostgreSQL "PG:service=lizmap_local" my_data.gpkg -lco SCHEMA=lizmap -
Build your map in QGIS from those PostGIS layers. Double-check (layer β Properties β Source) that the datasource starts with
service='lizmap_local'.
In QGIS, open the Lizmap plugin, configure your map (base layers, popups, toolsβ¦), and click
Save. It writes a myproject.qgs.cfg file next to your myproject.qgs.
Copy the project files (and any GeoPackage / data files if you used Option A) into the
My projects repository folder of the Codespace: lizmap/instances/myprojects/.
In VS Code Desktop (or the browser editor), open the Explorer, find that folder, and either drag-and-drop your files onto it, or right-click it β Upload... and pick the files. No extra tool needed.
π‘ Terminal alternative:
gh codespace cp ./myproject.qgs ./myproject.qgs.cfg 'remote:/workspaces/lizmap-docker-compose/lizmap/instances/myprojects/'
Go to your Lizmap URL β the My projects repository now lists myproject. π
- Project not listed / "repository path" error: the file must be directly under
lizmap/instances/myprojects/and named*.qgswith its*.qgs.cfgbeside it. - Layers fail to load on the server but work locally: the datasource is probably hard-coded to
localhost:8093instead ofservice='lizmap_local'. Re-add the PostGIS connection using the Service field (step 1B.3) and re-save the project. - Visibility: My projects is viewable by anonymous visitors by default (like the demos), so you can share the map link. Change it in Admin β Maps if you prefer it private.
- Lifetime: everything (files and PostGIS data) lives inside your Codespace and is removed when the Codespace is deleted. This instance is meant for evaluation, not production.