This project is a QGIS 4 plugin for interactive raster georeferencing. The plugin was originally made to replace a workflow where digitizers would use Google Earth to interactively georeference a raster and the tools (move, rotate, scale...) found in that software have been reimplemented. Compared to the standard raster georeferencer tool of QGIS, which needs control points and an export, this plugin allows the visualization of the result immediately, on top of the other layers of the map.
In QGIS, open the "Plugins" > "Manage and install plugin" dialog. Install the "Freehand raster georeferencer" plugin.
Use the QGIS plugin directory at src/fhrgr:
- Download a ZIP of the repository or clone it using "git clone"
- Copy the
src/fhrgrdirectory directly under your QGIS plugin directory and name the copyFreehandRasterGeoreferencerto match the registered plugin package - Restart QGIS; the plugin should be listed in the "Plugins" > "Manage and install plugin" dialog
The plugin is QGIS 4-only. QGIS 3 compatibility is not maintained on this branch. A legacy version for QGIS 2 is in the qgis2 branch.
See http://gvellut.github.io/FreehandRasterGeoreferencer/
Report issues at https://github.com/gvellut/FreehandRasterGeoreferencer/issues
- The plugin uses GDAL from the QGIS runtime to read rasters for display. PNG, JPEG, TIFF, PDF, and other raster formats can be loaded when the local QGIS GDAL build includes the matching driver, including formats such as ECW in distributions that ship that support. Very large rasters should still be avoided because the plugin keeps a display image in memory for interactive painting.
- This georeferencer only supports affine transformations (without shearing) and not the full set of transformation algorithms (including rubbersheeting) the standard QGIS raster georeferencer provides
- There is limited support for changing CRS: If the CRS of the map changes, you will have to adjust georeferencing of the layer in the new CRS.
- The raster layer added by this plugin does not have all the capabilities of a normal QGIS raster layer: It is limited to visualization and modification using the provided tools. However, a normal QGIS raster file, along with georerencing information, can be easily exported by the plugin and can be reloaded using the standard "Add Raster" functionality.
- The display renderer uses deterministic conversion rules rather than the full QGIS raster renderer. Non-Byte data is rescaled to 8-bit for display, color tables and alpha bands are interpreted where present, and extra bands may be ignored with a warning.
- If a pixel transformation is performed, the plugin shows a raster-display warning when the raster is opened. When exporting the georeferencing, unless you are fine with the pixel transformation, be sure to check the "Only export world file" in the dialog, then choose the original raster file: In that case, no image data will be exported, just the georeferencing (including rotation).
- It is also possible to perform the pixel transformation yourself, before opening the raster with the plugin. For example, if you have a 10-band raster with band 5, 3, 6 as RGB, you can use GDAL to export a version of the raster with those bands in the correct order. Make sure the dimensions (width, length) of the raster stay the same though. Then use that version of the raster for georeferencing with the plugin. Finally, export only the world file and select the original raster. The original raster will then have a world file.
This repository uses uv for local tooling.
uv sync --frozen
uv run task lint
uv run task format-check
uv run task test
uv run task packagePlugin code, ordinary tests, and development scripts live in src/fhrgr, src/tests, and src/scripts.
With QGIS 4 installed, run uv run task setup-qgis-tests from the repository root.
This stages the locked pytest dependencies in the gitignored .qgis-test-deps/
directory. Run the setup again after updating the pytest dependencies in uv.lock.
- Run
uv run task testfor the full suite, oruv run pytest -m qgis_desktop -v -rPfor the QGIS tests and their output. The launcher uses/Applications/QGIS4.appby default. Pass--qgis-app='/Applications/QGIS Preview.app'to select a different QGIS 4 app bundle. - In VS Code, select
.venv/bin/pythonas the interpreter, enable pytest, and setpython.testing.pytestArgsto["src/tests"]. To select a different bundle, add"--qgis-app=/Applications/QGIS Preview.app"as a single entry in that array.
The full QGIS suite runs offscreen at 1× scale. Two separate launcher tests run
the dialog layout check at 1.5× and 2×. Each launch uses a temporary profile and
runs tests from src/qgis_tests against the checkout. Use
uv run pytest -m 'not qgis_desktop' to run only the tests that work without QGIS.
To set the plugin version, edit version under [project] in pyproject.toml, then run uv run plugin-version sync to update src/fhrgr/metadata.txt. The uv run task sync-version task runs the same command.
The package task uses qgis-plugin-ci to create a QGIS plugin ZIP from src/fhrgr using the version in pyproject.toml. The ZIP is written to the repository root as fhrgr.<version>.zip and contains the plugin under FreehandRasterGeoreferencer/, matching the existing QGIS registry package. The plugin directory includes the required LICENSE file. The .ui files are loaded at runtime, so no generated ui_*.py files are needed.
Before the first deployment, configure the QGIS_PLUGIN_TOKEN repository secret as described below.
For each release:
-
Make sure the code to release is on your local
masterbranch. -
Set
versionunder[project]inpyproject.toml, for example0.400.0. Do not include thevprefix. Choose a version whosev<version>tag does not already exist, and update the changelog insrc/fhrgr/metadata.txtfor that release. -
Copy the project version into the plugin metadata:
uv run task sync-version
-
Check the release locally:
uv run task lint uv run task format-check uv run task test -
Review
git statusand stage all files intended for the release, including new files. Commit the release changes, then pushmaster:git commit -m "Prepare release 0.400.0" git push origin master git statusThe working tree must be clean, with local
masterandorigin/masterpointing to the same commit. -
Start deployment:
./deploy.sh
The wrapper reads the version from
pyproject.toml, creates and pushes an annotated tag such asv0.400.0, and watches the release workflow using~/bin/_deploy/watch_workflow.sh(use--nowatchon machines without the watcher).GitHub Actions runs on
v<version>tags, checks that the tag matches the project version, creates the GitHub release for that tag, and uploads the plugin ZIP to that release and the QGIS registry. The plugin metadata and ZIP filename keep the unprefixed version, such as0.400.0.
To remove the most recently created GitHub release:
./last-release-delete.shThe release workflow requires a token for uploading plugin versions to the QGIS plugin registry:
- Sign in to the QGIS plugin registry with an account allowed to manage the plugin. The plugin must already be registered.
- Open the plugin page and append
tokens/create/to its URL (https://plugins.qgis.org/plugins/<package_name>/tokens/create/). Create a plugin-specific token and copy its value. - In this GitHub repository, open Settings > Secrets and variables > Actions > New repository secret. Set the name to
QGIS_PLUGIN_TOKEN, paste the token into Secret, and click Add secret.
The workflow passes secrets.QGIS_PLUGIN_TOKEN to qgis-plugin-ci with --qgis-token.