[gdal-dev] Possibility to use config options in VRT-files

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Tue Jun 14 06:48:07 PDT 2022


Hi,

I can confirm that despite having <PagingAllowed>OFF</PagingAllowed> in the wfs.xml file ogrinfo generates GetFeatures with COUNT and STARTINDEX as in this sample from the debug log:

HTTP: Fetch(https://geodata.tampere.fi/geoserver/wfs?typename=maankaytto:KAAVAYKSIKOT_ALUE_MVIEW&SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&TYPENAMES=maankaytto:KAAVAYKSIKOT_ALUE_MVIEW&STARTINDEX=0&COUNT=1000000)
ERROR 1: HTTP error code : 400

When it comes to the QGIS case I wonder if it could be possible to use Python and pyqgis for setting temporary environmental variables and opening the wfs.xml file. If it works then it would be possible to set also GML_ATTRIBUTES_TO_OGR_FIELDS.

-Jukka Rahkonen-

Lähettäjä: Pekka Sarkola <pekka at gispo.fi>
Lähetetty: tiistai 14. kesäkuuta 2022 16.20
Vastaanottaja: Even Rouault <even.rouault at spatialys.com>
Kopio: Pekka Sarkola <pekka.sarkola at gispo.fi>; Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>; 'gdal-dev at lists.osgeo.org' (gdal-dev at lists.osgeo.org) <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] Possibility to use config options in VRT-files

Hi,

Ok, I understand and agree with this security issue.

However, I still have problems with the WFS service file.

This works perfectly:

    ogrinfo WFS:https://geodata.tampere.fi/geoserver/wfs?typename=maankaytto:KAAVAYKSIKOT_ALUE_MVIEW<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeodata.tampere.fi%2Fgeoserver%2Fwfs%3Ftypename%3Dmaankaytto%3AKAAVAYKSIKOT_ALUE_MVIEW&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2355d7c51b73426e7e4208da4e088e22%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637908095892972141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=A6Kozvr5wkzMwd7yS6tWp7fT1LvnzWxP9tzMWTyEFQI%3D&reserved=0> -al -so --config OGR_WFS_PAGING_ALLOWED OFF

Without  OGR_WFS_PAGING_ALLOWED, I got some HTTP 400 errors.

I create WFS Service file (tre_wfs.xml):

<OGRWFSDataSource>
  <URL>https://geodata.tampere.fi/geoserver/wfs?typename=maankaytto:KAAVAYKSIKOT_ALUE_MVIEW<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgeodata.tampere.fi%2Fgeoserver%2Fwfs%3Ftypename%3Dmaankaytto%3AKAAVAYKSIKOT_ALUE_MVIEW&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2355d7c51b73426e7e4208da4e088e22%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637908095892972141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=A6Kozvr5wkzMwd7yS6tWp7fT1LvnzWxP9tzMWTyEFQI%3D&reserved=0></URL>
  <PagingAllowed>OFF</PagingAllowed>
</OGRWFSDataSource>

When I run this service file with ogrinfo:

ogrinfo -ro tre_wfs.xml -al -so

I also got those HTTP 400 errors. However, if I add config parameter:

ogrinfo -ro tre_wfs.xml -al -so --config OGR_WFS_PAGING_ALLOWED OFF

It works, I'm confused.

Rgs,

Pekka




ti 14. kesäk. 2022 klo 15.52 Even Rouault (even.rouault at spatialys.com<mailto:even.rouault at spatialys.com>) kirjoitti:

Hi,

It is not possible to set configuration options in VRT files. There could potentially be security issues in doing so and reading untrusted VRT.

Even
Le 14/06/2022 à 14:49, Pekka Sarkola a écrit :
Hi!

I had some other problems with the WFS service description file, need to check that.

However, in another case I'd like to use GML_ATTRIBUTES_TO_OGR_FIELDS -config for WFS service.

Rgs,

Pekka

ti 14. kesäk. 2022 klo 8.58 Rahkonen Jukka (jukka.rahkonen at maanmittauslaitos.fi<mailto:jukka.rahkonen at maanmittauslaitos.fi>) kirjoitti:
Hi,

Do you need to use just the OGR virtual format https://gdal.org/drivers/vector/vrt.html<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgdal.org%2Fdrivers%2Fvector%2Fvrt.html&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2355d7c51b73426e7e4208da4e088e22%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637908095892972141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=9cqvOvjBsw59cWVS6Qa1grxGz5O1fzHQE6DjYA25Gd0%3D&reserved=0>? The simple WFS service description file https://gdal.org/drivers/vector/wfs.html<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgdal.org%2Fdrivers%2Fvector%2Fwfs.html&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2355d7c51b73426e7e4208da4e088e22%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637908095892972141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=1dR9jTbtEho%2BG3tz8op8iACkOkgNhnfaQ2%2FTEWVlFcw%3D&reserved=0> seems to support an additional PagingAllowed element as immediate children of the OGRWFSDataSource for that purpose.

-Jukka Rahkonen-

Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org<mailto:gdal-dev-bounces at lists.osgeo.org>> Puolesta Pekka Sarkola
Lähetetty: tiistai 14. kesäkuuta 2022 8.34
Vastaanottaja: 'gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>' (gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>) <gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>>
Aihe: [gdal-dev] Possibility to use config options in VRT-files

Hi!

Could it be possible to add GDAL configuration options to VRT-files?

I have worked with several WFS-services, where I have to set OGR_WFS_PAGING_ALLOWED=OFF -option to get data.It is not problem to add system variable or --config when running ogrinfo/ogr2ogr from command line. But I like to use the same .vrt-files also in QGIS and it will be more convenient to add necessary config-options to vrt-files.

Rgs,

Pekka





_______________________________________________

gdal-dev mailing list

gdal-dev at lists.osgeo.org<mailto:gdal-dev at lists.osgeo.org>

https://lists.osgeo.org/mailman/listinfo/gdal-dev<https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2355d7c51b73426e7e4208da4e088e22%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637908095892972141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=SzJbJuBEctSTcoi%2BppR2UXh1666TLOTj2O%2FRa8IIOFM%3D&reserved=0>

--

http://www.spatialys.com<https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.spatialys.com%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C2355d7c51b73426e7e4208da4e088e22%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637908095892972141%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Z4ZSfVGuoY3561YnLe%2B53H7B8uQVLkiWcLwj3yJyu%2F8%3D&reserved=0>

My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220614/b8318b65/attachment-0001.htm>


More information about the gdal-dev mailing list