-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add support of reading WMTS Get Cap document #3026
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
Conversation
+1 on merging this in. @fgravin, do you agree with reviewing this and tell if the format would work for you? |
Yes i will review this shortly. |
Thanks for this work. For example the xml above:
gives you a
while the WMS one follows more xml structure with
Check name and capitals. I think we must be consistent between formats, and use more xml.format methods (like |
I actually copy/pasted the test from ol2's wmts format and worked on make those tests pass. The structure you get is more or less the one that ol2 would gave you. That being said, I get your point about consistency. I will refactor that, this is not much. Thanks for your input. |
</TileMatrixSet> | ||
</Contents> | ||
<ServiceMetadataURL xlink:href="http://www.maps.bob/wmts/1.0.0/WMTSCapabilities.xml"/> | ||
</Capabilities> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No new line at end of file.
Thanks. At this point I think it makes sense that the WMTS GetCapabilities format be consistent with the WMS GetCapabilities format. Thanks @fgravin for the review. |
ol.format.WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) { | ||
var value = ol.xml.pushParseAndPop({}, | ||
ol.format.WMTSCapabilities.TMS_PARSERS_, node, objectStack); | ||
if (!goog.isDef(value) || !goog.isDef(value.identifier)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can't work in advanced mode :
In TMS_PARSERS_
you set the identifier as
'Identifier': ol.xml.makeObjectPropertySetter(
ol.format.XSD.readString, 'identifier')
You tell the compiler to set this property name explicitly to 'identifier' but when you call the property via value.identifier
the compiler renames it so the reference is lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am really not familiar with google closure. If I understand well I must use something more like this:
if (!goog.isDef(value) || !goog.isDef(value.get('identifier'))) {
}
Is that right?
The format doesn't work in advanced build mode. I added some comments to point some errors on. I think that a better use of You should test your format in built mode too. |
Dumb question maybe: how can I run my unit tests with the "built" mode? |
Okay I updated the PR with you guys feedback. I also added an example inspired by WMS GetCap. Ready to review. |
Hi, thanks, i'll take time to review this in the week. |
You can't launch your tests against build mode. |
Ok so that's what I did. I hosted my new example with |
Hi guys, any update on this PR? |
Hi, i'll try to review it and test it on friday. |
Hi, I've created another PR that builds on this. It alters the WMTS source optionsFromCapabilties function to work with the new variable names, which allows for WMTS sources to be created from a capabilities document. Could you guys please have a look at #3142? |
@htulipe Thanks for your work. I reviewed and tested it back against your changes and i find it pretty good. It works in build mode, and the capabilities structure fits better the XML document and the WMSCapabities format. Just few minor comments would be to be sure you respect case for all XML elements. You can test the format against http://sdi.georchestra.org/geoserver/gwc/service/wmts?REQUEST=GetCapabilities&SERVICE=WMTS&VERSION=1.0.0 that have a pretty complete content. Thanks |
Hi @fgravin, thanks for the feedback. I am guessing you are refering to following XML tags:
Those tags are read from That being said, I am not sure that |
|
||
/** | ||
* @classdesc | ||
* Format for reading WMTS capabilities data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Point missing at end of sentence.
goog.object.set(resource, 'template', template); | ||
} | ||
if (goog.isDef(resourceType)) { | ||
goog.object.set(resource, 'resourceType', resourceType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use bracket notation instead.
I found a bug while testing #3142 that also affects this PR. When using the built ol.js rather than ol-debug.js, the gets within operationsMetadata had their constraints variable renamed. This was due to dot notation being used in ol.format.OWS.readConstraint_ |
fe09eeb
to
2708926
Compare
This PR is independent of any other PR in the repo and was forked directly from master. I can not talk for @sarametz but I think her work needs my PR to be approved and merge first. Hence, if your question is what PR is the first in the stack, it is this one. |
As a reminder, I integrated your comments but I did not integrated last @fgravin comments regarding OWS format. I am still waiting to hear from him. |
My branch is "the ability to create WMTS source from capabilities" and requires @htulipe's changes in this PR so this should be merged first. |
If there is a bug in OWS format it must be fixed but it is outside of the scope of this PR. This PR can be merged and then another one can focus on refactoring/fixing OWS format. |
@htulipe could you provide more information about your contribution on OWSFormat ? What this format is used for ? Is it marked as stable etc.. ? |
The PR is #1863 You can find extended information on comments and commit message. Here is a sum up: In OL2, WMTS GetCap was read in one module mixing OWS tags and WMTS tags. Since OWS tags are not only related to WMTS documents (other standard might use it), it make sense to have 2 distinct parsers. With that consideration, I wanted to make a Regarding the implementation details, I relied on OL2 unit tests. Hence the returned objects look just the same as in OL2. While you made a #3026 (comment), about this, the OWS format was merged as is. Please let me know if you need other details. |
Ok it's clear thanks. Is OWSFormat used in other formats than WTMS right now ? |
Right now it is not used anywhere else. To be confirmed but I think that OWS format was not marked |
This commit fixe openlayers#2721. It still lacks the possibility to create layer from the GetCap document. It also lacks the reading of TMS limits.
Ok I updated the PR with modification to OWS format. Regarding the
Hence, it is possible to have several Ref.: http://schemas.opengis.net/ows/1.1.0/owsOperationsMetadata.xsd |
Ok thanks, looks good to me. |
Looks good to me too. Thanks for your continued effort on this. That's great. |
Add support of reading WMTS Get Cap document
Woo, a day to be remembered! Thanks guy for your reviews. |
This commit fixe #2721. It still lacks the possibility to create layer from the GetCap document. It also lacks the reading of TMS limits.