Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nextgis/mapservices
Browse files Browse the repository at this point in the history
  • Loading branch information
yellow-sky committed Jun 19, 2017
2 parents 9ae9efd + dd6628b commit aa6be4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions src/data_source_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from .supported_drivers import KNOWN_DRIVERS


def parse_wms_url_parameter(url, parameters_str):
def parse_wms_url_parameter(url, parameters_str, ignore_layers=False):
wms_url = url.split("?")[0]

o = urlparse.urlparse(url)
Expand All @@ -28,7 +28,9 @@ def parse_wms_url_parameter(url, parameters_str):
parameters.update({k: v})

for k,v in parameters.items():
if k.upper() in ["VERSION", "REQUEST", "FORMAT", "CRS", "STYLES", "SERVICE", "DPIMODE", "CONTEXTUALWMSLEGEND"]:
if ignore_layers and k.upper() in ["LAYERS", "STYLES"]:
continue
if k.upper() in ["VERSION", "REQUEST", "FORMAT", "CRS", "LAYERS", "STYLES", "SERVICE", "DPIMODE", "CONTEXTUALWMSLEGEND"]:
wms_params.append("%s=%s"%(k,v))
else:
wms_url_params.append("%s=%s"%(k,v))
Expand Down Expand Up @@ -83,12 +85,14 @@ def read_from_ini(cls, ini_file_path):
ds.tms_origin_y = ConfigReaderHelper.try_read_config_int(parser, 'tms', 'origin_y')

#WMS
ds.wms_layers = ConfigReaderHelper.try_read_config(parser, 'wms', 'layers')

ds.wms_url, ds.wms_params, ds.wms_url_params = parse_wms_url_parameter(
ConfigReaderHelper.try_read_config(parser, 'wms', 'url', reraise=(ds.type == KNOWN_DRIVERS.WMS), default=""),
ConfigReaderHelper.try_read_config(parser, 'wms', 'params', default="")
ConfigReaderHelper.try_read_config(parser, 'wms', 'params', default=""),
(ds.wms_layers is not None)
)

ds.wms_layers = ConfigReaderHelper.try_read_config(parser, 'wms', 'layers')
ds.wms_turn_over = ConfigReaderHelper.try_read_config_bool(parser, 'wms', 'turn_over')

#GDAL
Expand Down Expand Up @@ -154,13 +158,14 @@ def read_from_json(cls, json_data):

#WMS
if ds.type.lower() == KNOWN_DRIVERS.WMS.lower():
ds.wms_layers = json_data['layers']

ds.wms_url, ds.wms_params, ds.wms_url_params = parse_wms_url_parameter(
json_data['url'],
json_data['params']
json_data['params'],
(ds.wms_layers is not None)
)

ds.wms_layers = json_data['layers']
ds.wms_turn_over = json_data['turn_over']

ds.format = json_data['format']
Expand Down
2 changes: 1 addition & 1 deletion src/metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name=QuickMapServices
qgisMinimumVersion=2.4
description=Collection of easy to add basemaps
version=0.18.6
version=0.18.7
author=NextGIS
[email protected]
about=Convenient list of services + search for finding datasets and basemaps. Please contribute new services via http://qms.nextgis.com!
Expand Down

0 comments on commit aa6be4d

Please sign in to comment.