@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 map 根据从要素层收到的数据集填充颜色。有没有办法在边界宽度增加的情况下保留特征层颜色。 但是如果我们尝试使用下面的代码增加边界的宽度,那么 map 上的颜色就会消失。
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)
关于ios - 如何在应用增加边界宽度的自定义渲染时保留 ArcGIS map 中填充的颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52071564/