So now I will break it up, and start with a smaller question:
I am trying to show 10 simple lines on a map with Map Kit. The lines have been loaded into a list called 'overlays' by a module called KMLviewer, or more exactly KMLparser, inside KMLviewer - from https://github.com/ooper-shlab/KMLViewer-Swift .
As you can see from my debugging log below, 'overlays' is a list of elements of the type 'MKOverlay', although in reality they are all MKPolyline(s). So how do I access the 2 geographic points that make up each line?
MKPolyline inherits from MKMultiPoint, which has a function:
Code Block func points() -> UnsafeMutablePointer<MKMapPoint>
"Returns an array of map points associated with the shape. "
But as you can see from my debugging below, I can't seem to access that function, now that the MKPolyline is "inside" an MKOverlay. So how do I access the points?:
(lldb) po overlays
▿ 10 elements
- 0 : <MKPolyline: 0x60000368bc60>
- 1 : <MKPolyline: 0x60000368bcd0>
- 2 : <MKPolyline: 0x60000368bd40>
- 3 : <MKPolyline: 0x60000368bdb0>
- 4 : <MKPolyline: 0x60000368be20>
- 5 : <MKPolyline: 0x60000368be90>
- 6 : <MKPolyline: 0x60000368bf00>
- 7 : <MKPolyline: 0x60000368bf70>
- 8 : <MKPolyline: 0x600003690000>
- 9 : <MKPolyline: 0x600003690070>
(lldb) po overlays[0]
<MKPolyline: 0x60000368bc60>
(lldb) po overlays[0].coordinate
▿ CLLocationCoordinate2D
- latitude : 64.47726683920816
- longitude : -21.420572185955933
(lldb) po overlays[0].points()
error: <EXPR>:3:13: error: value of type 'MKOverlay' has no member 'points'
overlays[0].points()
~~~ ^~
(lldb)
So, thanks for checking. As suggested by Claud31, it seems KMLParser cannot detect the right styles for LineString in kml.So the overall question still remains: Why are none of the MKPolyline(s) visible on the map?
For more information on this project, see https://developer.apple.com/forums/thread/680107
As you know, the original KML_Sample.kml does not contain LineString elements, I guess the feature was not fully tested.
I wrote some partial answer on the original thread you have shown.
But, to show your kml file more precisely as it is, you may need to update KMLParser and all related types.