Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support additional files such as SVG symbols #23

Open
olivierdalang opened this issue Sep 15, 2022 · 5 comments
Open

Support additional files such as SVG symbols #23

olivierdalang opened this issue Sep 15, 2022 · 5 comments
Assignees

Comments

@olivierdalang
Copy link

Not sure if this is not yet supported or not documented or if I got something wrong.

I have layers with custom SVG symbols defined with relative paths, like this:

- base directory
  - projects
    - myproject.qgs
  - project_data
    - mydata.geojson
    - images
      - svg1.svg
      - svg2.svg
      - ...

myproject.qgs refers to datasource using ../project_data/mydata.geojson and to svgs using ../project_data/images/svg1.svg.

It works well in QGIS desktop. In G3W suite however, I could not find how to make the SVG symbols available. I thought I could just upload my svg symbols to the shared-volume/project_data with the file upload GUI, like done for datasources, but it doesn't work.

I could make them load by copying my svg symbols to shared-volume/media/project_data, but that's not doable by users through the UI.

Is there a way to achieve this ? Or could this feature be implemented ?

Worth noting that from what I understand, unfortunately the QGIS files get rewritten by g3w-admin to alter the datasource paths. A similar approach would not work for advanced use cases for SVGs (for instance data-defined path to the SVG, that can't just be searched/replaced). I think what is needed is either to be able to upload a project package instead of just a QGIS file (project package being a zipped folder of a QGIS project with arbitrary files), or to document what relative paths structures should be used for projects to be able to access files in shared-volume/media/project_data (I guess it's ../../project_data/myimage.svg)

Is the way QGIS files are rewritten documented somewhere ? Is the structure of the shared-volume directory supposed to be stable in the future (in which case we could just use ../../project_data instead of ../project_data and you could maybe skip rewriting the QGIS file).

Thanks for your inputs !

@Raruto
Copy link
Collaborator

Raruto commented Sep 15, 2022

Hi @olivierdalang, can you attach a sample file as well? (sometimes it can be worth a thousand words for the final developer 😄)

@Raruto Raruto added the feature label Sep 15, 2022
@wlorenzetti
Copy link
Member

Hi @olivierdalang as for QGIS-server standalone you have to set a QGIS3.ini file throug which said to QGIS-server search possible SVG files.

I just push a commit to do that g3w-suite/g3w-suite-docker@1f0163e, now inside config/qgis folder there is a QGIS3.ini file to use:

config/
├── g3w-suite
│   ├── overrides
│   │   ├── static
│   │   └── templates
│   ├── settings_docker_cadastre.py
│   └── settings_docker.py
├── _nginx
│   └── django_ssl.conf
├── nginx
│   └── django.conf
└── qgis
    └── QGIS3.ini

By default in this QGIS3.ini I set the [svg] value :

[svg]
searchPathsForSVG=/usr/share/qgis/svg/, /shared-volume/project_data/svg/

As you can see now you have toi create a folder inside /shared-volume/project_data and put it your SVG files.

This commit at now is on dev branch of g3w-suite-docker repository https://github.com/g3w-suite/g3w-suite-docker/tree/dev.

@olivierdalang
Copy link
Author

Ideally I'd like to not alter searchPathsForSVG, because there could be multiple different project using different SVGs with same names, which would result in conflicats (wrong symbol showing in a project).

In QGIS desktop, it's possible to define relative path to SVGs, which works well if you keep your SVG next to your QGIS project file. But such a setup cannot be uploaded to G3W it seems (as QGIS projects are uploaded using a different process than files).

In the mean time I could make it work by using relative paths mimicking the structure in the docker container

root/
├── media
│   └── projects
│       └── myproject.qgs
└── project_data
    ├── data.geojson
    ├── symbol1.svg
    ├── symbol2.svg
    └── symbol3.svg

This way the path to symbols is ../../project_data/symbol1.svg and it seems to work both locally and in G3W-suite.

@wlorenzetti wlorenzetti self-assigned this Oct 10, 2022
@wlorenzetti
Copy link
Member

@olivierdalang sorry for the delay in the response, I'll add it to documentation thanks.

@Raruto Raruto transferred this issue from g3w-suite/g3w-admin Nov 17, 2023
@Raruto Raruto removed the feature label Nov 17, 2023
@Raruto
Copy link
Collaborator

Raruto commented Nov 17, 2023

Moved in here from g3w-admin while waiting for the documentation to be updated.

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

No branches or pull requests

3 participants