Week 7 : Completion of Multiple KML Overlay UI

ARYAN_GUPTA
Published: 07/20/2020

After 7 weeks worth of coding, researching , experimenting and implementing, I have completed the KML Overlay UI! Feeling good, and quite confident now :))

A user can now do the following in the KML Overlay : 

  • Add and Load KML Files
  • Remove selected files, or remove all
  • Customize each file w.r.t color, linewidth
  • Overwrite the original KML with modified features
  • Merge multiple KML Files into one, and export as .kml file

What did you do this week?

On discussing with my mentors, I decided to finish off the last feature for the Overlay, i.e. the Merge KML Files feature. Looking at it, it looks like I only wrote 40 - 50 lines of code, but the whole week was spent researching and experimenting, so I could write the logic in those perfect 40  - 50 odd lines of code :))

Researching on the net, Merging KML Files is not a popular source of discussion. I barely found related material, and it was mostly based on combing KML/XML i.e. similar tags be grouped together. Since I wish to display lots of data on the map, it wasn't the feasible way. I tried out a lot of experiments : how to join different files, how to delete conflicting data (eg. namespaces), how to arrange the data in a human readable format as well.

I finally came up with the logic of copying elements from each file, inserting a new root of <Folder> on each of them, and putting them all inside a folder. Each file would have its namespace removed to avoid conflictions of data. And it worked!!

What is coming up next?

All major features have been completed. Its time to start writing tests! Its going to be really tough.. I have never written tests before, and I would have to write a lot of them to test the capabilities of my work :))

Did you get stuck anywhere?

The whole process of coding is getting stuck, researching, solving and moving on. I got 'stuck' implementing the logic for the above, as I was using lxml, and most of the resources online were using xml.ElementTree, which has quite stark differences. This led to me experimenting, and double checking each line of code that I wrote.

 

Looking forward to a great week! 

Thanks for reading :))

 

1000 characters left