如何在应用边界宽度递增的自定义渲染时保留 ArcGIS 地图中填充的颜色


@IBOutlet weak var mapView: AGSMapView!
private var map:AGSMap!
private var featureLayer:AGSFeatureLayer!
func loadAirQuality()
{
if self.featureLayer == nil 
{
//create feature table using a url
self.featureTable = AGSServiceFeatureTable(url: URL(string: hourlyMapURL)!)
//create feature layer using this feature table
self.featureLayer = AGSFeatureLayer(featureTable: self.featureTable)
//create feature table using a url. This is the CSV table hosted on ESRI Online
//self.zipSRACityTable = AGSServiceFeatureTable(url: URL(string: self.zipSRACityURL)!)
self.featureLayer.labelsEnabled = false
// set opacity of SRA regions
self.featureLayer.opacity = Constant.mapOpacity
self.mapView.graphicsOverlays.add(graphicsOverlay)
}
//add feature layer to the map
self.map.operationalLayers.add(self.featureLayer)
//add graphics overlay to the map view
self.mapView.locationDisplay.autoPanMode = 
AGSLocationDisplayAutoPanMode.recenter
}

以上是正在使用的默认代码,ArcGIS 地图根据从要素图层接收的数据集填充颜色。有没有办法在增加边界宽度的情况下保留要素图层颜色。 但是,如果我们尝试使用以下代码增加边界宽度,则颜色将从地图中消失。

let lineSymbol = AGSSimpleLineSymbol(style: .solid, color: UIColor.black, width: 1)
self.featureLayer.renderer = AGSSimpleRenderer(symbol: lineSymbol)

你试试这个代码。

// Create a outline symbol
let outlineSymbol = AGSSimpleLineSymbol(style: .solid, color: .green, width: 2)
// Create a fill symbol for polygon graphic
let fillSymbol = AGSSimpleFillSymbol(style: .forwardDiagonal, color: .green, outline: outlineSymbol)

最新更新