-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
KML write support #2244
KML write support #2244
Conversation
@bartvde, do you mind trying again? |
I can open up it now @elemoine what XML schema is this supposed to validate against? It does not validate against KML 2.2 http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd |
Yes, that's the schema. |
then you should use:
instead, but many validation errors, I assume this might be because of the extensions |
all errors look like the above 2 |
Style goes before the geometry, so sequence should be:
this gets rid of the first error, still need to look into the gx: one |
okay it validates fine against: https://developers.google.com/kml/schema/kml22gx.xsd which is what we need I guess since of the gx: tags, so only sequence of tags needs changing as mentioned above. I think we should output a reference to the schema as well to avoid confusion.
|
Thanks Bart. So do we need to change the xmlns? |
@elemoine yes it needs changing in order to validate, the following validates for me and which is what I would probably output:
|
um, think you mean "...that are not KML properties"? |
Yes, I updated the comment. Thanks. |
@bartvde are you sure about the first url in the schemaLocation? It's not a reference to an xsd file. |
yes I'm sure that's the URI that the schema applies to see eg http://www.w3schools.com/schema/schema_schema.asp |
I see. That makes more sense now. |
Branch updated.
http://erilem.net/ol3/kmlwrite/examples/kml.html is up-to-date. |
I'm wondering whether it makes sense to have an example, given that this will probably change because of the transform issue. I don't think any of the other formats have an example for write, do they? |
It will just slightly change.
No, but they probably should. I think it's good to have examples for features provided by the library. And in this case I see some value in having an example that shows how to make locally generated files downloadable (the |
Thanks again Bart! Does this every node.setAttributeNS occurrences should be changed to ol.xml.setAttributeNS? |
no I think only the ones with the 'xmlns' prefix |
I like the OL2 vector-formats example, where you could read/write in any of the supported formats. Useful for testing as well as being a demo |
I've changed the node.setAttributeNS occurrences for xmlns attribute and reordering correctly placemark's child nodes. The validation is now successfull with oxygen. |
great, I love valid XML ;-) |
👍 |
Thanks a lot @oterral. This looks good. I've updated http://erilem.net/ol3/kmlwrite/examples/kml.html. @bartvde please tell us if this is good to merge to you. |
I'll have a quick look now |
*/ | ||
ol.format.KML.XSD_URIS_ = [ | ||
'http://www.opengis.net/kml/2.2', | ||
'https://developers.google.com/kml/schema/kml22gx.xsd' |
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 wonder why the xsd is in here, since the xsd is not a (namespace) URI.
In other formats we have used schemaLocation: https://github.com/openlayers/ol3/blob/master/src/ol/format/wfsformat.js#L83:L89 instead
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. I did things this way initially because I did not understand that part very well. I'll add a commit that mimics what's in the wfs format.
Nice work guys, no more comments from me. |
Thanks for the thorough review. I'll add commits based on your review comments. |
I've just added new commits that take @bartvde's comments into account. I'll merge when Travis is all green. |
thanks for addressing this @elemoine |
This PR adds "write" support to the KML format. You can see it in action at http://erilem.net/ol3/kmlwrite/examples/kml.html.
Current limitations:
The code was written by @oterral and myself.