Skip to content

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

Merged
merged 1 commit into from
Feb 4, 2015

Conversation

htulipe
Copy link
Contributor

@htulipe htulipe commented Dec 8, 2014

This commit fixe #2721. It still lacks the possibility to create layer from the GetCap document. It also lacks the reading of TMS limits.

@elemoine
Copy link
Member

elemoine commented Dec 9, 2014

+1 on merging this in. @fgravin, do you agree with reviewing this and tell if the format would work for you?

@fgravin
Copy link
Contributor

fgravin commented Dec 9, 2014

Yes i will review this shortly.
Thanks for the work.

@fgravin
Copy link
Contributor

fgravin commented Dec 9, 2014

Thanks for this work.
The parser works well and i like the output format. Unfortunatly, the behavior is too different from the ol.format.WMSCapabilities:
You use a lot of goog.object.set to define the output format as you want instead of basing your object on the XML structure. I find it good personnally, but it is not how other formats seemed to have been designed, specially the WMSCapabilities one.

For example the xml above:

<Layer>
<ows:Title>Blue Marble Next Generation</ows:Title>
<ows:Abstract>Blue Marble Next Generation NASA Product

gives you a

layers: [{
    title: 'Blue Marble Next Generation',
    abstract: 'Blue Marble Next Generation NASA'
}]

while the WMS one follows more xml structure with

Layer: [{
    Title: 'Blue Marble Next Generation',
    Abstract: 'Blue Marble Next Generation NASA'
}]

Check name and capitals.

I think we must be consistent between formats, and use more xml.format methods (like ol.xml.pushParseAndPop) to build the output structure.

@htulipe
Copy link
Contributor Author

htulipe commented Dec 9, 2014

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>
Copy link
Member

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.

@elemoine
Copy link
Member

elemoine commented Dec 9, 2014

That being said, I get your point about consistency. I will refactor that, this is not much.

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)) {
Copy link
Contributor

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.

Copy link
Contributor Author

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?

@fgravin
Copy link
Contributor

fgravin commented Dec 10, 2014

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 ol.xml.makeObjectPropertyPusher ol.xml.makeObjectPropertySetter etc.. will avoid you to manipule the objects as you do, avoiding some compilation issues.

You should test your format in built mode too.

@htulipe
Copy link
Contributor Author

htulipe commented Dec 10, 2014

Dumb question maybe: how can I run my unit tests with the "built" mode?

@htulipe
Copy link
Contributor Author

htulipe commented Dec 13, 2014

Okay I updated the PR with you guys feedback. I also added an example inspired by WMS GetCap. Ready to review.

@fgravin
Copy link
Contributor

fgravin commented Dec 16, 2014

Hi, thanks, i'll take time to review this in the week.

@fgravin
Copy link
Contributor

fgravin commented Dec 16, 2014

You can't launch your tests against build mode.
You can try to make a small example and include the last built version you got, or work with the host-examples workflow.

@htulipe
Copy link
Contributor Author

htulipe commented Dec 16, 2014

Ok so that's what I did. I hosted my new example with host-examples, the parser was working.

@tschaub tschaub modified the milestone: v3.2.0 Dec 22, 2014
@htulipe
Copy link
Contributor Author

htulipe commented Jan 12, 2015

Hi guys, any update on this PR?

@fgravin
Copy link
Contributor

fgravin commented Jan 13, 2015

Hi, i'll try to review it and test it on friday.

@sarametz
Copy link
Contributor

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?

@fgravin
Copy link
Contributor

fgravin commented Jan 16, 2015

@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.
I suggest you to open your result object, and watch all property name against the XML tags, to be sure it fits well.
(HTTP, GET, ServiceIdentification, OperationsMetadata etc..) I'm not sure the DCP.HTTP.GET is an array by the way (it's not the case for WMS Capabitliies).

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

@htulipe
Copy link
Contributor Author

htulipe commented Jan 16, 2015

Hi @fgravin, thanks for the feedback. I am guessing you are refering to following XML tags:

  • ServiceIdentification
  • ServiceProvider
  • OperationsMetadata

Those tags are read from owsformat.js (a previous contribution of mine I made in anticipation of WMTS format). That format was designed following philosophy explained in my previous comment!. I am perfectly OK for refactoring that format as well but it will induce backward compatibility break (since owsformat was released on 3.0.0).

That being said, I am not sure that owsformat is widely used, so the compatibility break won't make too much damage. Anyhow, it is not my place to make that decision. What do you think?


/**
* @classdesc
* Format for reading WMTS capabilities data
Copy link
Member

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use bracket notation instead.

@elemoine
Copy link
Member

I've added a couple of new, pretty minor, comments. I'll merge this when they are addressed. Thanks for your effort @htulipe. And thanks @fgravin for reviewing this again.

sarametz added a commit to sarametz/ol3 that referenced this pull request Jan 19, 2015
@sarametz
Copy link
Contributor

I've updated PR #3142 with changes that address the comments made by @elemoine. The difference between the two branches can be seen here. Please have a look if you have time.

@sarametz
Copy link
Contributor

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_

I have fixed this in #3142 with commit df5c799

@htulipe htulipe force-pushed the wmts-getcap branch 2 times, most recently from fe09eeb to 2708926 Compare January 25, 2015 17:51
@htulipe
Copy link
Contributor Author

htulipe commented Jan 25, 2015

Okay I updated the PR with @elemoine comments. I did not made any modification regarding your comment @fgravin (for me it's outside of this PR scope, please see my comment about that).

@elemoine
Copy link
Member

elemoine commented Feb 2, 2015

I am a bit lost here. Which branch should be reviewed? @htulipe's or @sarametz's? I'd like to review the most up-to-date branch, and I don't want to review "the ability to create WMTS source from capabilities" and "WMTS GetFeatureInfo" for now. This should be addressed with separate PRs. Thanks.

@htulipe
Copy link
Contributor Author

htulipe commented Feb 2, 2015

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.

@htulipe
Copy link
Contributor Author

htulipe commented Feb 2, 2015

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.

@sarametz
Copy link
Contributor

sarametz commented Feb 2, 2015

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.
However, there is a bug in this PR that has been addressed in my branch (see #3026 (comment) above)

@htulipe
Copy link
Contributor Author

htulipe commented Feb 2, 2015

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.

@fgravin
Copy link
Contributor

fgravin commented Feb 3, 2015

@htulipe could you provide more information about your contribution on OWSFormat ? What this format is used for ? Is it marked as stable etc.. ?

@htulipe
Copy link
Contributor Author

htulipe commented Feb 3, 2015

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 ol.format.OWS module and then a WMTS parser that would rely on the former. The former is in #1863 and the latter is in this PR.

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.

@fgravin
Copy link
Contributor

fgravin commented Feb 3, 2015

Ok it's clear thanks. Is OWSFormat used in other formats than WTMS right now ?
I think it makes sense to follow same philosophy as other formats in ol3, and also get quite same structure object like the WMS reader.
So I think you should change object property names to match XML tags, case sensitive at least.

@htulipe
Copy link
Contributor Author

htulipe commented Feb 3, 2015

Right now it is not used anywhere else. To be confirmed but I think that OWS format was not marked @stable in previous releases, hence there would be no backward compatibility break. I will do the refactor at noon.

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.
@htulipe
Copy link
Contributor Author

htulipe commented Feb 3, 2015

Ok I updated the PR with modification to OWS format. Regarding the Get attribute it is an array because the XSD specifies that HTTP tag is

<choice maxOccurs="unbounded">

Hence, it is possible to have several Get attributes.

Ref.: http://schemas.opengis.net/ows/1.1.0/owsOperationsMetadata.xsd

@fgravin
Copy link
Contributor

fgravin commented Feb 4, 2015

Ok thanks, looks good to me.

@elemoine
Copy link
Member

elemoine commented Feb 4, 2015

Looks good to me too. Thanks for your continued effort on this. That's great.

elemoine pushed a commit that referenced this pull request Feb 4, 2015
Add support of reading WMTS Get Cap document
@elemoine elemoine merged commit 2d3e5d2 into openlayers:master Feb 4, 2015
@htulipe
Copy link
Contributor Author

htulipe commented Feb 4, 2015

Woo, a day to be remembered! Thanks guy for your reviews.

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

Successfully merging this pull request may close these issues.

5 participants