Create single kmz from several other kmz files

Oct 14, 2014 at 2:11 AM
I am using an external process that creates separate kmz files for a set that i request.
I want to take the resulting kmz files and merge them into a single kmz file.
Having trouble. right now i'm using the first kmz as a source and then when i loop over the others i try to clone the document or folder objects and then insert them into the source kml using AddFeature.
It's not working out so well for me so far. Not sure what i am doing wrong but i either get an error in GE about junk after the doc tag or i just don't get the multiple elements added.
I think what i really need to do is clone the folder from each kmz and push them into a new kmz but i'm unclear on how to get that done.
Oct 17, 2014 at 5:51 AM
If you have multiple documents/features I think you will need to place them inside a single document (which you'll need to create from scratch). So, your structure of the final file should be something like:
    <!-- Merge the other documents/features here -->
You've not mentioned if the other kml data has styles or not. If it does then what you could do is use the StyleResolver to inline the style of the element for you, which will also clone it. Also, you said that you're dealing with kmz files, you may also need to copy across any resources (such as images) that are used by the features.

Hope that makes sense and sets you off in the right direction, let me know if there are any problems.