geocodezip / geoxml3

Automatically exported from code.google.com/p/geoxml3
102 stars 87 forks source link

improving performance of big polygons parsing #127

Open alexandru-popescu opened 5 years ago

alexandru-popescu commented 5 years ago

This is a functional fix for polygon parsing; the bug that is addressed by the fix is that polygons with > 1000 lines take a long time to parse. This is because the loop goes through the polygon parsing for each coordinate entry: this is unnecessary and degrades performance a lot: more coordinates results in more unnecessary loops. The fix cuts the loop for polygons after the first parsing. Of course, this is a sort of a hack ... the correct way to fix this would be to follow the top-down structure of the kml instead of looping directly over all coordinates, just to go back to the parent, parse the parent and then do it all over again ...