Skip to content

Move project extent reprojection from Django to QGIS worker - #1763

Merged
manylon merged 1 commit into
masterfrom
QF-8613-move-reprojection
Aug 18, 2026
Merged

Move project extent reprojection from Django to QGIS worker#1763
manylon merged 1 commit into
masterfrom
QF-8613-move-reprojection

Conversation

@manylon

@manylon manylon commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Links to:

Until now, we did the re-projection for QgisProject.extent from the clients CRS to our target one (WGS 84) in the Django on every run of QgisProjectQueryset.update_from_details() , which is not efficient. Thats why this PR moves it to QGIS worker.

Changes:

  • Add reproject_extent() to docker-qgis/qfc_worker/utils.py, using QgsCoordinateTransform to reproject a QgsRectangle to WGS84 (EPSG:4326) and validating the result against the target CRS's area of use
  • Compute the reprojected extent in open_qgis_project_temporarily() right after reading the project, storing the WKT (or an empty string on failure) in details["extent"]
  • In QgisProjectQueryset.update_from_details() in docker-app/qfieldcloud/project/models.py just parse the already-reprojected WKT with GEOSGeometry
  • Remove the unused transform_wkt_crs() helper and its Django-side tests
  • Add tests for reproject_extent()
  • Document in type_defs.py and process_projectfile.py that extent is now pre-re-projected in WGS84

@duke-nyuki

Copy link
Copy Markdown
Collaborator

@suricactus suricactus left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 lines less! Great!

Comment thread docker-qgis/qfc_worker/utils.py Outdated
Comment thread docker-qgis/qfc_worker/commands/process_projectfile.py Outdated
@manylon
manylon force-pushed the QF-8613-move-reprojection branch from 27709c8 to 8fa6f97 Compare August 14, 2026 07:31
Comment thread docker-qgis/qfc_worker/utils.py Outdated
Comment thread .github/workflows/test.yml Outdated
Comment thread docker-qgis/qfc_worker/utils.py Outdated
@manylon

manylon commented Aug 17, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, will clean history and merge.

- Add `reproject_extent()` to `docker-qgis/qfc_worker/utils.py`, using `QgsCoordinateTransform` to reproject a `QgsRectangle` to WGS84 (EPSG:4326) and validating the result against the target CRS's area of use
- Compute the reprojected extent in `_extract_project_details`, then store the WKT (or an empty string on failure) in `details["extent"]`
- In `QgisProjectQueryset.update_from_details()` in `docker-app/qfieldcloud/project/models.py` just parse the already-reprojected WKT with `GEOSGeometry`
- Remove the unused `transform_wkt_crs()` helper and its Django-side tests (`geometry_utils.py`, `test_geometry_utils.py`, `test_utils.py`)
- Add tests for `reproject_extent()`
- Document in `type_defs.py` that `extent` is now pre-reprojected WGS84 WKT
@manylon
manylon force-pushed the QF-8613-move-reprojection branch from 7a8bed7 to d86e098 Compare August 17, 2026 13:19
@manylon
manylon merged commit c317ab0 into master Aug 18, 2026
21 checks passed
@manylon
manylon deleted the QF-8613-move-reprojection branch August 18, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants