Reputation: 546
I have a kml file:
After the show all data from kml file on map kit is okay. but in kml file I can't show the icon.
This is the icon in the kml file:
This is an annotation code:
open class KMLDocument: KMLElement {
open var overlays: [MKOverlay] = []
open var annotations: [KMLAnnotation] = []
open var styles: [String: KMLStyle] = [:]
open var placemarks: [KMLPlacemark] = []
public convenience init(_ element: AEXMLElement, generateMapKitClasses: Bool) {
self.init(element)
if generateMapKitClasses {
initOverlay()
initAnnotation()
}
}
fileprivate func initAnnotation() {
for pointPlacemark: KMLPlacemark in placemarks {
if let point: KMLPoint = pointPlacemark.point {
let annotation = KMLAnnotation(point.coordinates)
annotation.title = pointPlacemark.name
annotation.subtitle = pointPlacemark.description
annotation.style = pointPlacemark.style
self.annotations.append(annotation)
}
}
}
}
Upvotes: 0
Views: 730
Reputation: 1385
In order for an icon image in a KML file to show up correctly in Google Earth or Maps, the icon image needs to be publicly accessible. When I put the URL for your icon image into my browser (https://www.svgimages.com/svg-image/s5/send-file-256x256.png), I just get a black screen and no image. So for whatever reason, that URL is not returning a valid, publicly accessible image file. It might work ok in a KML viewer that has special access to that server and can get the image, but probably won't work anywhere else. You might also want to check that it's actually returning a PNG file, and not an SVG file (since the URL contains "svg" in two places), since KML only supports JPG, PNG, and GIF images (plus TIFF and GeoTiff for overlays).
Upvotes: 1