-
Notifications
You must be signed in to change notification settings - Fork 68
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: out-of-spec coordinates #68
Comments
Haha, KML is such a trash fire. So, I think we could parse this, but it's highly ambiguous. The |
Thanks, I did some testing and google earth seems to use the same logic I implemented here: handymenny/leaflet-kmz@b45dd44 That is, every 3 numbers is a new tuple, so altitude would no longer be optional (in that syntax) |
So I guess the approach would be to first detect this invalid syntax, and then take the approach that altitude is mandatory? I wouldn't want to make altitude mandatory for all datasets, which would make valid data parse incorrectly. |
Yes, that would be a correct approach. But I would just check if a coordinate has more than 3 elements (maybe better 6) and if the number of elements is multiple of 3 (actually google earth handles also cases where this is not true, using components of the previous coordinate). In that case the coordinate is split into two or more coordinates. Then a flatMap() takes care of recreating an array of consecutive coordinates |
The correct way to separate tuples in the coordinates field is to separate them with a space, but I saw some kml documents that used a comma instead:
Google Earth parses them correctly, so is there any chance that this library will support this out-of-spec syntax?
The text was updated successfully, but these errors were encountered: