join/merge csv-file & shapefile

Discussion created by apfelapps on Apr 14, 2019
Latest reply on Apr 16, 2019 by NFurness-esristaff

I managed to load a shapefile and color the the layer based on the value of the field "KTNR" with following code: 


// Instantiate a map using a basemap.
map = AGSMap()

// Create a shapefile feature table from a named bundle resource.
let shapefileTable = AGSShapefileFeatureTable(name: "g1g14vz")

// Create a feature layer for the shapefile feature table.
featureLayer = AGSFeatureLayer(featureTable: shapefileTable)

let lineSymbol = AGSSimpleLineSymbol(style: .solid, color: UIColor(white: 0.6, alpha: 1), width: 0.5)
let symbol1 = AGSSimpleFillSymbol(style: .solid, color: .yellow, outline: lineSymbol)
let symbol2 = AGSSimpleFillSymbol(style: .solid, color: .red, outline: lineSymbol)
let symbol3 = AGSSimpleFillSymbol(style: .solid, color: .blue, outline: lineSymbol)

let classBreak1 = AGSClassBreak(description: "0 to 5", label: "0 to 5", minValue: 0, maxValue: 5, symbol: symbol1)
let classBreak2 = AGSClassBreak(description: "5 to 10", label: "5 to 10", minValue: 5, maxValue: 10, symbol: symbol2)
let classBreak3 = AGSClassBreak(description: "10 to 30", label: "10 to 30", minValue: 10, maxValue: 30, symbol: symbol3)
let classBreakRenderer = AGSClassBreaksRenderer(fieldName: "KTNR", classBreaks: [ classBreak1, classBreak2, classBreak3])
featureLayer.renderer = classBreakRenderer

// Add the layer to the map.


What I'm now trying to do is using the data from a csv-file as the field for the AGSClassBreaksRenderer instead of "KTNR". After hours of googling and checking the sample iOS ArcGIS projekt I still don't know how to accomplish that. Can I somehow join the data from the csv to the data from the shapefile? Or can I add the csv-data as another layer and then reference that layer in AGSClassBreaksRenderer? Or can I merge the shapefile with the csv-file somehow and create a new layer out of them? Or is there a different approach to my problem?


Best regards,