diff --git a/README.md b/README.md index 388d713..bde0bb6 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ * PROJECT, compulsory, path where the project will be written on the file system. * SOURCES, compulsory, it's a list of layer sources. It can be tile url or QGIS DataSource URI or files on the filesystem, separated by a semicolon. Especially for QGIS DataSource URI, it must be url quoted twice (first the url, second the whole datasource string). - * FILES, optional, legacy parameter, it's a list of files on the filesystem, separated by a semicolon. It is overriden by SOURCES. + Previously FILES. * NAMES, compulsory, it's a list of names, separated by a semicolon. It will be used for the legend. Items in this list should match layers in the FILES list. * OVERWRITE, optional, false by default. Boolean if we can overwrite the existing PROJECT above. Values can be '1', 'YES', 'TRUE', 'yes', 'true'. * REMOVEQML, optional, false by default. Boolean if we can remove the QML. The style is already in the QGS file. Values can be '1', 'YES', 'TRUE', 'yes', 'true'. @@ -52,9 +52,9 @@ NAMES=Basemap;My layer 1;MyLayer 2;Layer 3& OVERWRITE=true ``` -In the sample request above, note that the datasource: ```type%253Dxyz%2526url%253Dhttp%25253A%2F%2Fa.tile.osm.org%2F%25257Bz%25257D%2F%25257Bx%25257D%2F%25257By%25257D.png``` were urlquoted twice. -The actual datasource is: ```type=xyz&url=http%3A//a.tile.osm.org/%7Bz%7D/%7Bx%7D/%7By%7D.png``` -Note that the actual url is: ```http://a.tile.osm.org/{z}/{x}/{y}.png``` +In the sample request above, note that the datasource: `type%253Dxyz%2526url%253Dhttp%25253A%2F%2Fa.tile.osm.org%2F%25257Bz%25257D%2F%25257Bx%25257D%2F%25257By%25257D.png` were urlquoted twice. +The actual datasource is: `type=xyz&url=http%3A//a.tile.osm.org/%7Bz%7D/%7Bx%7D/%7By%7D.png` +Note that the actual url is: `http://a.tile.osm.org/{z}/{x}/{y}.png` Thus in order to send the request, the url needs to be quoted first before it was inserted into datasource uri (to quote & symbol and = from url). Then, the datasource needs to be quoted again, because it was sent via GET requests url (to quote & symbol and = from datasource query params). diff --git a/filters/map_composition.py b/filters/map_composition.py index 46c91cf..71982b7 100644 --- a/filters/map_composition.py +++ b/filters/map_composition.py @@ -51,7 +51,7 @@ def responseComplete(self): SOURCES=type=xyz&url=http://tile.osm.org/{z}/{x}/{y}.png?layers=osm; /path/1.shp;/path/2.shp;/path/3.asc& FILES={Legacy Name for Sources Parameter} - NAMES=Layer 1;Layer 2;Layer 3& + NAMES=basemap;Layer 1;Layer 2;Layer 3& REMOVEQML=true& OVERWRITE=true& """ @@ -90,11 +90,15 @@ def responseComplete(self): # Overwrite means create from scratch again remove(project_path) + # Take datasource from SOURCES params sources_parameters = params.get('SOURCES') - # support legacy params: FILES + + # In case SOURCES empty, maybe they are still using FILES. + # Support legacy params: FILES. if not sources_parameters: sources_parameters = params.get('FILES') + # In case FILES also empty, raise error and exit. if not sources_parameters: request.appendBody('SOURCES parameter is missing.\n') return