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

Add versioning for GML format #2746

Merged
merged 31 commits into from
Oct 27, 2014
Merged

Add versioning for GML format #2746

merged 31 commits into from
Oct 27, 2014

Conversation

fgravin
Copy link
Contributor

@fgravin fgravin commented Sep 24, 2014

This PR proposes to add versoning for GML format.
It is based on a gml/base.js that contains base GML format objects and methods.
Then 2 versions ol.format.GML.v2 and ol.format.GML.v3 inherit from base to implement

  • the read for GML 2.1.2
    <gml:coordinates>
    <gml:outerBoundaryIs>
    <gml:innerBoundaryIs>
  • the read/write for GML 3.1.1

Also, WFS format has been changed a little to use by default an ol.format.GML.v3 format to read features from the WFS response. You can change this default behavior by passing a gmlFormat option to the ol.format.WFS constructor. You can then read a WFS 1.0.0 with GML 2 for example. A test has been added in wfs format tests.

@bartvde
Copy link
Member

bartvde commented Sep 24, 2014

@fgravin does this break backwards compatibility or not? Since ol.format.GML is marked stable.

@fgravin
Copy link
Contributor Author

fgravin commented Sep 24, 2014

@fgravin does this break backwards compatibility or not? Since ol.format.GML is marked stable.

Yes it does, as the format to use now is either ol.format.GML.v3 or ol.format.GML.v2.
What options do we have ?

@bartvde
Copy link
Member

bartvde commented Sep 24, 2014

Maybe use ol.format.GML.base or ol.format.GMLBase instead for the parent class, and make ol.format.GML an alias for ol.format.GML.v3 ?

@fgravin
Copy link
Contributor Author

fgravin commented Sep 24, 2014

Ok please have a look to the 2 last commits that ensure the backward compatibility.

@fgravin
Copy link
Contributor Author

fgravin commented Sep 26, 2014

@bartvde what do you think about the global approach ?

@bartvde
Copy link
Member

bartvde commented Sep 26, 2014

sorry for the delay @fgravin I'll try and do proper review on Monday

* @type {ol.format.GMLBase|undefined}
* @api
*/
olx.format.WFSWriteGetFeatureOptions.prototype.gmlFormat;
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if we need this currently. Since WFS is only WFS 1.1, and it is kind of implicitly tied to GML 3. Unless you can think of a good use case here, I'd leave this out until the WFS format gets versioned?

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 added a test to read WFS 1.0 with just changing the GML format version. The parsing worked well without the need to version the WFS too.

Actually it is the main purpose of my PR : to be able to read a WFS with GML2.

Copy link
Member

Choose a reason for hiding this comment

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

Okay so you might want to adapt: https://github.com/openlayers/ol3/blob/master/src/ol/format/wfsformat.js#L18 ?
I don't think this applies to WFS-T though.

@bartvde
Copy link
Member

bartvde commented Sep 29, 2014

@fgravin I've put in some (minor) comments but the bigger question here is about changing static functions to instance functions. I'm not sure if this is really desired, but I don't have a good alternative as well currently. Interested to hear other opinions on this. cc @elemoine @ahocevar @tschaub

Also, can you please verify that for ol.format.GML (the alias) all api methods show up in the build and in the api docs?

@elemoine
Copy link
Member

I'm not sure if this is really desired, but I don't have a good alternative as well currently. Interested to hear other opinions on this. cc @elemoine @ahocevar @tschaub

@tonio, @fgravin and I discussed it before this PR was created. This is the solution we found for the case where we have a base class with version-specific child classes. We (I mean @fgravin :-) can provide more details if necessary.

@bartvde
Copy link
Member

bartvde commented Sep 29, 2014

okay thanks for confirming @elemoine would be good to write this up somewhere I guess when other people want to implement versioned formats? Currently all format content is still in the Wiki (such as https://github.com/openlayers/ol3/wiki/Parsing-XML-documents-with-ol.xml-and-ol.format.XML)

function(node, opt_options) {
var geometry = this.readGeometryElement(node,
[this.getReadOptions(node, goog.isDef(opt_options) ? opt_options : {})]);
return (goog.isDef(geometry) ? geometry : null);
Copy link
Member

Choose a reason for hiding this comment

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

No brackets.

@fgravin
Copy link
Contributor Author

fgravin commented Oct 3, 2014

I've updated my PR

  • change commit messages to match convention
  • change gml files name to match convention
  • update some comments about the version
  • put PARSERS static objects into prototype, cause the use of this.constructor was not working in avdanced mode, because the PARSERS were renamed
  • use Object() function on PARSERS declaration, cause the linter was showing a warning when we declare an object in the prototype.@elemoine and I didn't find a better solution for this
  • add the gml:box support

All tests passes, examples work in avdanced mode and apidoc is well generated for the alias ol.format.GML.

@bartvde
Copy link
Member

bartvde commented Oct 3, 2014

from my side no objections to merging this

@bartvde
Copy link
Member

bartvde commented Oct 14, 2014

can we merge this @elemoine @fgravin ?

@elemoine
Copy link
Member

@tonio to make the final call on this one… :-)

@tonio
Copy link
Member

tonio commented Oct 14, 2014

LGTM. I’m working on GFI based on this for another PR.

On 14 October 2014 14:19, Éric Lemoine notifications@github.com wrote:

@tonio https://github.com/tonio to make the final call on this one… :-)


Reply to this email directly or view it on GitHub
#2746 (comment).

Antoine Abt

Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex

Tel : 00 33 4 79 44 44 94
Mail : antoine.abt@camptocamp.com
http://www.camptocamp.com

tonio added a commit that referenced this pull request Oct 27, 2014
@tonio tonio merged commit 67ec0b5 into openlayers:master Oct 27, 2014
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.

None yet

4 participants