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

Publish added vector layers as WFS in QGIS Server #64

Open
JakobMiksch opened this issue Jul 30, 2024 · 4 comments · May be fixed by #75
Open

Publish added vector layers as WFS in QGIS Server #64

JakobMiksch opened this issue Jul 30, 2024 · 4 comments · May be fixed by #75
Milestone

Comments

@JakobMiksch
Copy link
Contributor

JakobMiksch commented Jul 30, 2024

Adding vector layers to a QGIS project file works as expected. But they are not published as WFS in the QGIS Server settings. See screenshot below.

Is it possible to use the QSA API to publish a vector layer as WFS in the QGIS Server settings block?

relevant links:

I hacked together this function which might be useful:

# get published WFS layers
wfsLayers, ok = QgsProject.instance().readListEntry('WFSLayers', '/')
print('wfs_layers', wfsLayers)

# set published WFS layers
def set_wfs_layers(qgis_project_instance, layer_ids):
    qgis_project_instance.writeEntry( "WFSLayers" , "/", layer_ids)
    geometry_precision = 8
    for layer_id in layer_ids:
        qgis_project_instance.writeEntry( "WFSLayersPrecision", "/" + layer_id, geometry_precision) 
    qgis_project_instance.write()

image

@JakobMiksch
Copy link
Contributor Author

@pblottiere I am considering to implement this.

My idea would be to add a wfs property to the "layer definition" so it would look like this:

  • type
  • name
  • datasource
  • overview (optional)
  • crs (optional)
  • publication
    • wfs
      • published (boolean)
      • precision (integer)
      • in future: transaction (update, insert, delete)
    • in future: wms
    • in future: wmts
    • in future: wcs

what do you think about that?

@pblottiere
Copy link
Owner

Hello @JakobMiksch,

I am considering to implement this.

Nice 🎉

what do you think about that?

Yes indeed it's a good idea 👍. I'm just afraid to clutter the layer definition 🤔.

Another way would be to add a specific service endpoint for layers. For example a POST /api/projects/<project_name>/layers/<layer_name>/wfs with a payload for options and configuration.

"published": True,
"geometry_precision": 8,
"update": True,
...

For WMTS with /api/projects/<project_name>/layers/<layer_name>/wmts:

"published": True,
"PNG": True,
"JPEG": False

And by default a layer could only be published in WMS? What do you think?

@JakobMiksch
Copy link
Contributor Author

JakobMiksch commented Aug 21, 2024

Your approach looks good as well.

QGIS published WMS by default, that's why I would leave this behavior with QSA as well. However, it should be possible to deactivate the publication of WMS for a layer.

Another question:
how should a user find out if a layer is for example published via WFS?

would that be in the response of GET /api/projects/{project}/layers/{layer} ?

@pblottiere
Copy link
Owner

QGIS published WMS by default, that's why I would leave this behavior with QSA as well. However, it should be possible to deactivate the publication of WMS for a layer.

Yes, I agree 👍. A POST /api/projects/<project_name>/layers/<layer_name>/wms entrypoint should be made available too.

how should a user find out if a layer is for example published via WFS?

To be consistent with the "publish" API, a GET /api/projects/{project}/layers/{layer}/wfs entrypoint would probably be enough.

@JakobMiksch JakobMiksch linked a pull request Aug 28, 2024 that will close this issue
@pblottiere pblottiere modified the milestones: v1.1.0, v1.2.0 Sep 24, 2024
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 a pull request may close this issue.

2 participants