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 a parser for reading and writing KML. #517
Conversation
This adds ol.parser.ogc.KML which can be used to read and write KML documents. NetworkLinks are retrieved asynchronously. Current caveats of the implementation are: * LabelStyle not yet implemented. Missing support in renderers. * When using shared structures the parser needs to be configured with dimension 2. * We need a better way to disable fill, currently we use opacity as a workaround. * We cannot really roundtrip documents, since some of the info is not preserved in the ol structures. But we can write out most of the important info.
This is now ready for review, TIA |
|
@@ -9,6 +9,9 @@ goog.require('ol.parser.Parser'); | |||
* @extends {ol.parser.Parser} | |||
*/ | |||
ol.parser.XML = function() { | |||
if (window.ActiveXObject) { |
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 think this should use goog.global
instead of window
. This will permit the parser to be used in environments where window
is not defined, e.g. NodeJS and WebWorkers.
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.
Good point @twpayne will make the change
What do you think about this being called |
That would be better @tschaub and also crossed my mind, is there a way to alias this, or does it involve moving directories? |
I would just put it in |
@@ -119,7 +119,7 @@ ol.style.Icon = function(options) { | |||
* @return {ol.style.IconLiteral} Literal shape symbolizer. | |||
*/ | |||
ol.style.Icon.prototype.createLiteral = function(feature) { | |||
var attrs = feature.getAttributes(); | |||
var attrs = feature && feature.getAttributes(); |
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.
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 looks really solid @bartvde (and was clearly a ton of work). My only minor comment is that I think it would be nice to have some more interesting data for the example (and I'm so sick of looking at that vmap0 rendering). But we can work on improving the example later. I'm sure @bitner would be happy to know that we're still testing with his Please merge. |
Agree on the example @tschaub I only copied it over from OL2. Will work on a better example. |
@bartvde, there's a not-too-complicated KML file at https://dl.dropbox.com/u/9071691/rbx13-route.kml if that helps. |
This adds ol.parser.ogc.KML which can be used to read and write KML documents.
NetworkLinks are retrieved asynchronously.
Current caveats of the implementation are:
dimension 2.
workaround.
preserved in the ol structures. But we can write out most of the important
info.