Skip to content

Conversation

@meyerlor
Copy link
Contributor

@meyerlor meyerlor commented Nov 23, 2025

Implements DXF export functionality allowing users to export the current map view as a DXF file via QGIS Server.

Features:

  • Export UI with scale, symbology mode (symbol layer/feature/none), and layer options

  • Automatic WFS layer detection (only WFS-enabled layers can be exported)

  • Filename format: ProjectName_Timestamp.dxf

  • Custom DXF export icons (white default, dark on hover)

  • QGIS Server FORMAT_OPTIONS support (MODE, SCALE, FORCE_2D, NO_MTEXT, USE_TITLE_AS_LAYERNAME)

  • Translations: en_US, de_DE, fr_FR

Limitations:

  • DXF layer order is determined by QGIS project configuration, not controllable from client

Needed/ToDo

  • Implementing Tests

Would love to see this in future lizmap versions - this is just a demonstration/draft. I'm happy to discuss how to advance this. Specific points needing some input are:

  • How to controll access to this feature (should it be enabled via the QGIS Plugin, should i implement user/group rights managment?
  • I could also try and move this implementation into a installable module like AltiProfil and similiar ones, if you think that it is not needed/wanted in lizmap core?

A working release:
lizmap-web-client-3.11.0-DXF-export.zip

As requested here:
3liz/qgis-wfsOutputExtension#27

@github-actions github-actions bot added this to the 3.11.0 milestone Nov 23, 2025
Implements DXF export functionality allowing users to export the current map view as a DXF file via QGIS Server.

Features:
- Export UI with scale, symbology mode (symbol layer/feature/none), and layer options
- Automatic WFS layer detection (only WFS-enabled layers can be exported)
- Filename format: ProjectName_Timestamp.dxf
- Preserves layer visibility, opacity, styles, and filters
- Custom DXF export icons (white default, dark on hover)

Technical improvements:
- Refactored into smaller, focused methods for better maintainability
- Precise scale calculations with proper geodesic formulas for geographic coordinates
- Eliminated code duplication (WFS filtering centralized)
- Proper event listener cleanup in disconnectedCallback
- Static constants for magic numbers (DPI, conversion factors)
- Functional programming patterns where appropriate
- Clear separation of concerns (rendering, data collection, export logic)

Translations: en_US, de_DE, fr_FR

Limitations:
- DXF layer order determined by QGIS project configuration

Open:
- Rights management (ACL2) needs maintainer input
@rldhont
Copy link
Collaborator

rldhont commented Nov 24, 2025

Thanks @meyerlor !

Can you provide a print screen ?

@nboisteault
Copy link
Member

@meyerlor thanks.
You just need to add English version in lizmap/modules/view/locales/en_US/dictionnary.UTF-8.properties. Translations are then handled via transifex.

@meyerlor
Copy link
Contributor Author

meyerlor commented Nov 24, 2025

@rldhont here a gif recording:
DXF-Export
And the created .dxf:
Bermatingen_2025-11-24T09-09-34.zip

One thing really buggers me - i can not control/manipulate the layer order in the resulting dxf, it always seems to be alphabetical.

@nboisteault ok, then i will delete the FR/DE translations!

@meyerlor
Copy link
Contributor Author

Can you provide some guidance how/if/where some rights-managment should be implemented? I have some time this weekend and would love to advance this (provided you want this functionality?) 😃
Some options i thought about:

  1. Like Printlayouts, create a new category in the Lizmap Plugin where you can set user(groups) to have the dxf-export functionality
  2. Have it in the repository-managment in LWC
  3. Implement it as installable module
  4. ... ?

@rldhont
Copy link
Collaborator

rldhont commented Nov 28, 2025

Hi @meyerlor I have imagined to add a config in lizmap-plugin.

@gioman
Copy link
Contributor

gioman commented Nov 30, 2025

I guess this fixes also 3liz/qgis-wfsOutputExtension#27

Implements user group restrictions for DXF export functionality
based on configuration from the QGIS plugin.

Client-side controls:
- Only display DXF export minidock when dxfExportEnabled is true
- Check user group membership against allowedGroups configuration
- Hide UI completely if user lacks access permissions

Server-side validation:
- Validate DXF export requests in GetMap controller
- Check dxfExportEnabled flag from project configuration
- Verify user belongs to allowedGroups (if specified)
- Return 403 Forbidden if user lacks permission

Configuration options (from .qgs.cfg):
- options.dxfExportEnabled (boolean): Enable/disable globally
- options.allowedGroups (string): Comma-separated group IDs
  Empty or unset: all users can export (when enabled)
  Non-empty: only users in specified groups can export

Implementation details:
- Handles both JSON boolean and string boolean values correctly
- Uses is_bool() check before string comparison to avoid type issues
- Enforces same access policy on both frontend and backend
- Translations managed via Transifex (English only in source)
@meyerlor
Copy link
Contributor Author

@gioman yes, exactly!

@nboisteault i removed the translations

I did open a PR to the lizmap-plugin: 3liz/lizmap-plugin#666

A working, installable release with the functionallity implemented (and the rights-managment which will be written into the .qgs.cfg with the plugin) can be downloaded here:
lizmap-web-client-3.11.0.dxf-export_acl.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants