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

r.in.wms: gdal user:password support #196

Merged
merged 5 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/r.in.wms/r.in.wms.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
#% key: wms_version
#% type:string
#% description: WMS standard version
#% options: 1.1.1,1.3.0
#% options: 1.1.0,1.1.1,1.3.0
#% answer: 1.1.1
#% guisection: Request
#%end
Expand Down
10 changes: 9 additions & 1 deletion scripts/r.in.wms/wms_gdal_drv.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ def _createXML(self):
block_size_y = etree.SubElement(gdal_wms, "BlockSizeY")
block_size_y.text = str(self.tile_size['rows'])

if self.params['username'] and self.params['password']:
user_password = etree.SubElement(gdal_wms, "UserPwd")
user_password.text = "%s:%s" % (self.params['username'], self.params['password'])

xml_file = self._tempfile()

etree.ElementTree(gdal_wms).write(xml_file)
Expand All @@ -137,11 +141,15 @@ def _download(self):
"geographic projection, \n try 'WMS_GRASS' driver or use WMS version 1.1.1."))

self._debug("_download", "started")

temp_map = self._tempfile()

xml_file = self._createXML()

# print xml file content for debug level 1
file = open(xml_file, "r")
neteler marked this conversation as resolved.
Show resolved Hide resolved
grass.debug("WMS request XML:\n%s" % file.read(), 1)
file.close()

if self.proxy:
gdal.SetConfigOption('GDAL_HTTP_PROXY', str(self.proxy))
if self.proxy_user_pw:
Expand Down