Closed cazitouni closed 1 year ago
There is now the possibility to define the templates in a separate file, which should make configuration a bit more pleasant. Example:
{
"name": "featureInfo",
"config": {
"default_qgis_server_url": "http://qwc-qgis-server/ows/",
"skip_empty_attributes": true
},
"resources": {
"wms_services": [
{
"name": "qwc_demo",
"root_layer": {
"name": "qwc_demo",
"layers": [
{
"name": "countries",
"info_template": {
"type": "wms",
"wms_url": "http://qwc-qgis-server/ows/qwc_demo",
"template_path": "/info_templates/countries.html"
}
}
]
}
}
]
}
},
and
qwc-feature-info-service:
[...]
volumes:
[...]
- ./volumes/info-templates:/info_templates:ro
You should use qwc-feature-info-service:v2023.05.11
or newer, and place your custom template HTML files below volumes/info-templates:/info_templates
. The config should be placed in volumes/config-in/<tenant>/tenantConfig.json
and then let the qwc-config-generator
generate the featureInfoConfig.json
.
Ok thanks, I realised after that the HTML suposed to be in info templae.
But my featureinfoconfig.json look like this :
It should work ? Or there is another thing to do ? Because when i click on the layer 'quartier' for my theme 'quartiers' I got an empty result. Still works well with the default forms. my template is a simple html file with a p tag in it to test if something happen.
Thanks for your answers, kind regards.
First of all make sure you're using qwc-config-generator-v2023.05.11, before that you explicitly create FeatureInfo service
and FeatureInfo layer
Resources and Permissions even for the public role (whereas now it should allow the templates by default if you have permissions_default_allow: true
in the tenantConfig.json).
Then check that the generated config/<tenant>/permissions.json
contains "info_template": true
for your layer.
Also look at the docker log output of qwc-feature-info-service
to see if you get any warnings regarding the template.
I do have the info_template = true in my permission.json no problem.
And logs for the feature info looks like this :
qwc-docker-qwc-feature-info-service-1 | [pid: 7|app: 0|req: 54/54] 172.19.0.16 () {70 vars in 3516 bytes} [Fri May 12 13:33:48 2023] GET /api/v1/featureinfo/quartiers?service=WMS&version=1.3.0&request=GetFeatureInfo&id=cd9941d5-d120-4b73-aba3-a8ea85982d42&layers=quartier&query_layers=quartier&srs=EPSG:3948&crs=EPSG:3948&info_format=text%2Fxml&with_geometry=true&with_maptip=false&height=101&width=101&feature_count=20&x=51&y=51&i=51&j=51&bbox=2033724.9150374115,7273242.332658548,2039069.498370745,7278586.915991882&FI_LINE_TOLERANCE=8&FI_POINT_TOLERANCE=16&FI_POLYGON_TOLERANCE=4®ion_feature_count=100 => generated 153 bytes in 10 msecs (HTTP/1.0 200) 2 headers in 79 bytes (1 switches on core 3)
I do not have any idea what to do next this I can't pinpoit where the error is.
Thanks you, Clément.
You can
docker-compose exec qwc-feature-info-service bash
apt-get update
apt-get install nano
nano /srv/qwc_service/feature_info_service.'py
add some print statements around [1] to see what is happening, then exit nano and kill $(pidof uwsgi)
at which point the service will restart with the modified sources and you can see the print output in the docker log.
[1] https://github.com/qwc-services/qwc-feature-info-service/blob/master/feature_info_service.py#L266
Found the issue, I made a mistake between info-templates in the volumes and info_templates in the container in the url in tenantconfig.
Anyway, thanks for your patience and quick answers.
Still, this could be a good idea to add the part that you have to write in the tenant config into a more practical gui in qwc_admin.
Maybe I'll look into it if I have time, what could be the best approach to do that ?
Thanks again for your time, kind regards, Clément.
Hello @manisandro, I allow myself of asking you again about my previous question regarding the implementation of a gui for the html template.
Thanks in advance for your answer, regards, Clément.
The themes plugin of the admin gui should serve as a good starting point for implementing a graphical template manager.
Hello,
I've came across the possibility to use html forms via the feature info service. But I try it by hardcoding text in the config, it renders well but it's not really covenient to do that. I would like to know if there is a possibility to use the admin console for that purpose. By adding a ressource and a permission for example ?
Maybe I missed something but I would enjoy to be able to do that.