KMLViewer Apple's example not working

前端 未结 2 1860
南旧
南旧 2021-01-20 15:17

I\'ve been searching for quite sometime an answer to my problem with no success. So here it goes...

KMLViewer, Apple\'s example is not working in some cases. After e

2条回答
  •  耶瑟儿~
    2021-01-20 16:11

    It looks like KMLViewer can only handle one LineString object per Placemark.

    For the route you tried, Google is returning two LineString objects in the "Route" Placemark (the last one in the file). KMLViewer only displays the second (last) LineString segment.

    Aside from updating the KMLViewer code to add support for multiple LineString objects per Placemark (which looks like a good exercise), you can try these two workarounds:

    Combine the coordinates from the two LineString objects into one LineString. Change:

    
        Route
        some cdata stuff here
        
            coord1 … coordN
            coordN+1 … coordK
        
        #roadStyle
    
    

    To this:

    
        Route
        some cdata stuff here
        
            coord1 … coordN coordN+1 … coordK
        
        #roadStyle
    
    

    The above might only make sense for routes (line segments) that are supposed to be continuous.

    Another workaround is to split the "Route" Placemark into multiple placemarks (one for each LineString):

    
        Route A
        some cdata stuff here
        
            coord1 … coordN
        
        #roadStyle
    
    
        Route B
        some cdata stuff here
        
            coordN+1 … coordK
        
        #roadStyle
    
    

    One issue with this is that the "description" which contains distance and time info will not match the split routes.

提交回复
热议问题