7

I am trying to create a WMTS endpoint with query parameters in the urls that contain a + character. So my resource url looks like this:

<ResourceURL format="image/png" template="http://localhost/wmts/{TileMatrix}/{TileCol}/{TileRow}.png?formula=(B8-B4)/(B8+B4)" resourceType="tile"/>

The formula query parameter contains a + character, which is not escaped when opening the endpoint in QGis. So in the html requests made by QGis, the formula is passed unaltered, and so the server interprets the + as white space. The specific calls look like this:

http://localhost/wmts/2/1/0.png?formula=(B8-B4)/(B8+B4)

But should look like this (plus sign escaped)

http://localhost/wmts/2/1/0.png?formula=(B8-B4)/(B8%2BB4)

To work around this, I tried to manually escape the character by changing the endpoint to

<ResourceURL format="image/png" template="http://localhost/wmts/{TileMatrix}/{TileCol}/{TileRow}.png?formula=(B8-B4)/(B8%2BB4)" resourceType="tile"/>

But in that case, QGis encodes the % symbol, leading to a dobule escaped formula that looks like this:

http://localhost/wmts/2/1/0.png?formula=B8%252BB4

So it looks like QGis escapes % but it does not escape + characters.

Is there any way to control this behavior?

closed as off-topic by underdark Feb 15 at 19:01

  • This question does not appear to be about geographic information systems (GIS) within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I understand that + is a reserved character. But I think QGIS might be inconsistent. If the url is assumed to be encoded, then + represents a whitespace and % should be left as-is. If not, + should be assumed to be "unencoded" and both should be escaped. According to wikipedia, % is not a reserved character and should not be escaped in urls (en.wikipedia.org/wiki/Percent-encoding). – yellowcap Nov 20 '17 at 15:25
  • You're right QGIS appears inconsistent - misunderstood the query, my bad. – Phil G Nov 20 '17 at 15:28
  • I'm voting to close this question as off-topic because it should be a bug report rather than a question on StackExchange. – underdark Feb 15 at 19:01

Browse other questions tagged or ask your own question.