imagiscope / EarthStudioTools

Blender Panel to import Google Earth Studio, KML Routes, and 3D Masking
Other
169 stars 29 forks source link

Points dropped during import #7

Open adrianpowell opened 2 years ago

adrianpowell commented 2 years ago

In Google Earth Studio, I have a detailed track that was created during a long trail run. It appears as if a lot of the points are getting removed during the import into Blender. I can see them in GES and in the KML, but even though I have Point Reduction set to 0, most of the points don't make it to Blender. It doesn't trim to some fixed limit rather it looks like it is dropping 4-5 points for every one that it imports and this happens throughout the route.

I've tried Nurbs & Poly, I've set the Point Reduction to 0, and added some debugging statements in the import script to see if maybe some precision loss was causing multiple points to appear as one, but so far I haven't found any cause or solution.

Do you have any insight into what might be going on or suggestions to change it?

Attached a zipped KML if that will help

activity_8452070996.zip

adrianpowell commented 2 years ago

I found one fix for this and the other issue I raised. It is probably overkill for most applications for for my use (trail running, lots of points, irregular track) it seems to work. In lines 641-6, I inverted the logic so that instead of omitting the Points it looks only for them. Had to adjust the code to handle a possible third coordinate value:

    pl = ""
    if coor.length != 0:
        for i in range (0,coor.length ):
            if coor[i].parentNode.nodeName == "Point":
                pointPl = coor[i].firstChild.nodeValue
                pointSplit = pointPl.split(',')
                plat = pointSplit[0].strip()
                plng = pointSplit[1].strip()
                if (len(pl) > 0):
                    pl += " "
                pl += (plat + "," + plng)  

I don't really understand why the Point nodes were skipped in the first place or what the wider implications might be of making this change, but wanted to share it in case it helps someone else.

imagiscope commented 2 years ago

There is an option for point removal in the UI. Set it to 0 for no reduction.