۠ࢢொଜϙϦΰϯΛඳը͢ΔؔΛ࡞
func drawMunicipality(_ mapView: MGLMapView, geoJson: Data) {
// GeoJSONをshapeデータに変換(省略)
// MGLShapeSourceを定義してstyleにSourceを追加(省略)
// 市町村ポリゴンのスタイルを定義
let fillStyleLayer = MGLFillStyleLayer(identifier: "municipality-fill-style", source: shapeSource)
fillStyleLayer.fillColor = NSExpression(
format: "MGL_MATCH(N03_001, '東京都', %@, '埼⽟県', %@, '千葉県', %@, '茨城県', %@, %@)",
UIColor.red,
UIColor.yellow,
UIColor.green,
UIColor.blue,
UIColor.black
)
fillStyleLayer.fillOpacity = NSExpression(forConstantValue: 0.2)
style.addLayer(fillStyleLayer)
// ポリゴンの輪郭線スタイルを定義
let lineLayer = MGLLineStyleLayer(identifier: "municipality-line-style", source: shapeSource)
lineLayer.lineWidth = NSExpression(forConstantValue: 1.0)
lineLayer.lineColor = NSExpression(forConstantValue: UIColor.black)
style.addLayer(lineLayer)
}
MapView.swift
(FP+40/QSPQFSUJFTͷʹΑͬͯ৭Λ͚͍ͨ߹
.(-@."5$)Λར༻͚ͯ͠Δ
Ұ൪࠷ޙͷ!σϑΥϧτΛఆٛ͢Δ
ԁͷඳը.(-'JMM4UZMF-BZFSΛར༻
ϙϦΰϯͷྠֲ.(--JOF4UZMF-BZFSΛར༻
ݝʹΑͬͯ৭Λมߋ