-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Allow for more tolerant processing of KML #3975
Allow for more tolerant processing of KML #3975
Conversation
…orrectly reuses IDs between different placemarks.
var id = queryStringAttribute(node, 'id'); | ||
id = defined(id) ? id : createGuid(); | ||
id = defined(id) && id !=="" ? id : createGuid(); |
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 single quotes for strings. Here you may just want to use id.length !== 0
since you are just checking for a non-empty string.
@tfili Done and fixed merge conflicts |
Does this fix #3941? |
@hpinkos, no. This uses placemarks as the context for items underneath so that wouldn't fix that issue. I'm not 100% sure how to solve that issue while still allowing for network links to update the same entities by id correctly. For example, if I have a network link that updates the position of a placemark named 'foo' and an id of 'foo' and that network link refreshes, then obviously I'd want the foo placemark to move, not have two foo placemarks. Perhaps the proper 'context' for using ignoring duplicate ids is on refreshable network links? It's not perfect but not having any insight into what GE is doing, it might be a good balance of trying to be true to spec and handling this crappy KML. |
Okay cool, thanks for the info! It sounded similar to that issue so I wanted to check. |
GE doesn't seem to particularly care about the ID's. I tested a network link KML with a lot of duplicate ID's, editing and refreshing, and and it treated them all as if they were unique no matter what the ID was. |
@mmacaula Can you resolve the conflicts again? Sorry, i was out most of last week. I'll test as soon as its updated. |
GE absolutely cares about the ids if you are working with NetworkLinkControl. If the ids are dupes or incorrect, the file won't work. Most NetworkLinks are full refreshes and not updates, and ids won't matter in those cases. |
You are correct, my mistake. Loading a networklinkcontrol and using targetID on a file with duplicate ID's throws an 'id not found' and fails to parse the networklinkcontrol file. |
@tfili done with merge (perhaps updating CHANGES.md is something that should be done right before final merge?) It seems like the best way to match GE (and therefore provide best experience for Cesium KML users) is to always create a new entity except when inside an updating network link? This would mean not using the same id as the kml node for the entity id, except when loading a refreshing network link. Then this would fix #3941, a nice bonus... Thoughts? |
This looks good to me. @mramato Do you have any comments before I merge this? |
Thanks @mmacaula, looks good to me. |
This PR addresses an issue we came across when implementing KML support for our customer.
The KML we had to ingest incorrectly contained some placemarks that looked like:
The problem was that this KML was reusing ids inside of placemarks. The empty string
id=""
and theid=" - Full Path"
.This is definitely malformed KML, and doesn't pass validators, however, it does work in Google Earth. This PR makes changes that provides a context-id for parsing placemarks that essentially prepends the placemark entity id to the id of any entity in the multi-geometry. I also check for an empty string in the
getOrCreateEntity
method to handle that case.I can create an issue if that fits your workflow better.