Skip to content

Commit

Permalink
Add fallback code for WMS 1.1.0 when parsing external wms
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Jan 12, 2024
1 parent 6202005 commit f9c5dc1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/config_generator/external_layer_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ def get_external_wms_layer(resource, url, layerName, infoFormat, logger):

capabilities = parseString(capabilitiesXml)
contents = getFirstElementByTagName(capabilities, "WMS_Capabilities")
if not contents:
contents = getFirstElementByTagName(capabilities, "WMT_MS_Capabilities")

targetLayer = None
for layer in contents.getElementsByTagName("Layer"):
Expand Down Expand Up @@ -165,7 +167,7 @@ def get_external_wms_layer(resource, url, layerName, infoFormat, logger):
boundingBox = getFirstElementByTagName(targetLayer, "BoundingBox")
if boundingBox is not None:
bbox = {
"crs": boundingBox.getAttribute("CRS"),
"crs": boundingBox.getAttribute("CRS") or boundingBox.getAttribute("SRS"),
"bounds": [
float(boundingBox.getAttribute("minx")),
float(boundingBox.getAttribute("miny")),
Expand Down Expand Up @@ -245,7 +247,7 @@ def get_external_wmts_layer(resource, capabilitiesUrl, layerName, crs, logger):
tileMatrixSet = child
tileMatrixName = getFirstElementValueByTagName(tileMatrixSet, "ows:Identifier")
supportedCrs = getFirstElementValueByTagName(tileMatrixSet, "ows:SupportedCRS")
crsMatch = re.search('(EPSG).*:(\d+)', supportedCrs)
crsMatch = re.search(r'(EPSG).*:(\d+)', supportedCrs)
if crsMatch and crs == "EPSG:" + crsMatch.group(2) and tileMatrixName in layerTileMatrixSet:
tileMatrix = tileMatrixSet.getElementsByTagName("TileMatrix")
break
Expand Down

0 comments on commit f9c5dc1

Please sign in to comment.