Post not yet marked as solved
Post marked as unsolved with 0 replies, 1,119 views
I am able to load KML on Google map with below code. But now I want to show .KMZ file on Google map. I did unarchived it & added Folder containing doc.kml & Files folder which comntains 1 image, & tried to show doc.kml file on Google map.But didn't succeeded.
func showKMLFile(kmlfileurl:URL) {
print("fileURL in show is \(kmlfileurl)")
var renderer: GMUGeometryRenderer!
var kmlParser: GMUKMLParser!
if self.mapView != nil {
kmlParser = GMUKMLParser(url:kmlfileurl)
kmlParser.parse()
renderer = GMUGeometryRenderer(map: self.mapView,
geometries: kmlParser.placemarks,
styles: kmlParser.styles)
renderer.render()
}
}
& I am calling this function like
let fileManager = FileManager.default
do {
let docsArray = try fileManager.contentsOfDirectory(atPath: docsPath)
print("docarray is \(docsArray)")
for obj in docsArray{
if obj == "doc.kml"
{
self.showKMLFile(kmlfileurl: URL(fileURLWithPath: docsPath + "/" + "FAIRMEAD LF" + "/" + obj))
}
}
} catch {
print(error)
}