I'm trying to display data from geojson file to google maps. i had display lines but i couldn't display data title at googleHere what i got paths only without titlesmap
let path = Bundle.main.path(forResource: "dat", ofType: ".geojson")
let url = URL(fileURLWithPath: path!)
geoJsonParser = GMUGeoJSONParser(url: url)
geoJsonParser.parse()
renderer = GMUGeometryRenderer(map: mapKitC, geometries: geoJsonParser.features)
for i in geoJsonParser.features {
if let feature = i as? GMUFeature {
let properties = feature.properties
//print(properties?["Name"]! ?? [String:AnyObject]())
print((properties?["Name"] as! String))
i.style = GMUStyle(styleID: "feat_1", stroke: UIColor.red, fill: .clear, width: 2, scale: 1, heading: 1, anchor: CGPoint.zero, iconUrl: nil, title: (properties?["Name"] as! String) , hasFill: true, hasStroke: true)
}
}
here is a simple of json in geojson file
{ "type": "FeatureCollection", "name": "Export_Output_2", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features": [{ "type": "Feature", "properties": { "Name": "الجزيرة", "description": null, "altitudeMode": "clampToGround", "REMARKS": "الجزيرة", "FID": "1", "Field_1": "الجزيرة" }, "geometry": { "type": "MultiPolygon", "coordinates": [ [ [ [50.016116765605382, 26.55069039986865], [50.015975528609339, 26.550991875762669], [50.015543249856229, 26.552092609191], [50.014021356227893, 26.555916886985312], [50.013986819836397, 26.555993389005849], [50.0139615327519, 26.55605189831601], [50.013937500451902, 26.556110416304062], [50.013914703626462, 26.556171199925231], [50.013893190939172, 26.556229735340509], [50.013872592497187, 26.55629053416698], [50.013853248846132, 26.556351341673729], [50.013834177740307, 26.5564166652394], [50.010366238955562, 26.55583737812676], [50.010393511923603, 26.555767597848071], [50.010456762048257, 26.555598755587489], [50.010516559775482, 26.555429888414469], [50.010573224326002, 26.555261000355909], [50.010626464910303, 26.555089831406779], [50.010676553278628, 26.554918640545011], [50.011099741935944, 26.553458982554702], [50.011300373154121, 26.552817103722361], [50.011331824976743, 26.55269769626123], [50.011356070762062, 26.552614352208838], [50.011381863106351, 26.55253327596817], [50.011409240723651, 26.552449953630379], [50.011438194289781, 26.552366642218029], [50.01146869440673, 26.552285598614549], [50.011501071619158, 26.55220456712059], [50.01153470354334, 26.552123545223392], [50.011569892050197, 26.552044791201482], [50.011606655769612, 26.551963791005878], [50.011644976066812, 26.551885058683109], [50.011684872292918, 26.55180633727754], [50.01172630602143, 26.55172988360998], [50.012049918940242, 26.551135195177299], [50.012152127902489, 26.550947367255439], [50.013113094152381, 26.549252177776619], [50.016116765605382, 26.55069039986865] ] ] ] } }]}