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

OperationsMetadata allows invalid nameless element #965

Open
CJGutz opened this issue Jan 14, 2025 · 0 comments
Open

OperationsMetadata allows invalid nameless element #965

CJGutz opened this issue Jan 14, 2025 · 0 comments

Comments

@CJGutz
Copy link

CJGutz commented Jan 14, 2025

There is an issue when instantiating the WebMapTileService object in some edge cases. Looping through operation metadata, it does not exclude metadata that lies under "OperationsMetadata" without a name field like "ExtendedCapabilities". I can see that you have handled that case in wfs200.py .

Here is an example with extended capabilities

Since an early return is done in OperationsMetadata, the object is still created, but with invalid OperationMetadata object. This makes it so that you are not able to make the gettile request. It would maybe make more sence to have an error raised in OperationsMetadata constructor in this case as it is not valid anyways as the comment says. Then it might be easier to pinpoint the issue.
For the case in the wmts file, either check for the "ExtendedCapabilities" path or only include metadata starting with "Operation".

I do not fully understand the wmts standard so I do not know how often this will be the case or if there are other possible metadata that can be found inside OperationsMetadata.

# ows.py, line 201
class OperationsMetadata(object):
    """Initialize an OWS OperationMetadata construct"""
    def __init__(self, elem, namespace=DEFAULT_OWS_NAMESPACE):
        if 'name' not in elem.attrib:  # This is not a valid element
            return
        self.name = elem.attrib['name']
        self.formatOptions = ['text/xml']
        parameters = []
        self.methods = []
        self.constraints = []
        ...

  def __repr__(self):
        return '<owslib.ows.OperationsMetadata {} at {}>'.format(self.name, hex(id(self)))
# wmts.py, line 217
        ...
        self.operations = []
        serviceop = self._capabilities.find(_OPERATIONS_METADATA_TAG)
        #  REST only WMTS does not have any Operations
        if serviceop is not None:
            for elem in serviceop[:]:
                self.operations.append(OperationsMetadata(elem))
# features/wfs200.py, line 122
        for elem in self._capabilities.find(nspath("OperationsMetadata"))[:]:
            if elem.tag != nspath("ExtendedCapabilities"):
                self.operations.append(OperationsMetadata(elem))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant