60 likes | 218 Views
Arc: Getting Data. Dr Andy Evans. Getting Data/Features from Layers. Assign your Layer to an appropriate Interface. IGeoFeatureLayer : Treat as geographical data IFeatureLayer : Treat as a general Layer IAttributeTable : Treat as an attribute table
E N D
Arc: Getting Data Dr Andy Evans
Getting Data/Features from Layers Assign your Layer to an appropriate Interface. IGeoFeatureLayer: Treat as geographical data IFeatureLayer: Treat as a general Layer IAttributeTable: Treat as an attribute table Get the Attribute Table or search the Layer.
Getting data Once we have our Layer, we want to get data from it. Map AttributeTable Layer Feature 234 Values
Getting the Attribute Table Assuming we have a Layer Enumeration, we set the Layer to an IAttributeTable. import com.esri.arcgis.geodatabase.*; IAttributeTablepAttributeTable = (IAttributeTable) enumLayer.next(); ITable table = pAttributeTable.getAttributeTable(); IRowrow = null; for (int i = 1; i <= table.rowCount(null); i++) { row = table.getRow(i); int index = table.findField("School"); Object value = row.getValue(index); }
Get Layer as AttributeTable Get actual Table Get each row Get a particular Field Getting the Attribute Table IAttributeTablepAttributeTable = (IAttributeTable) enumLayer.next(); ITable table = pAttributeTable.getAttributeTable(); IRowrow = null; for (int i = 1; i <= table.rowCount(null) ; i++) { row = table.getRow(i); int index = table.findField("School"); Object value = row.getValue(index); }
Getting data Alternative is to get data from a Feature. Map AttributeTable Layer Feature 234 Values First though, we need to get only the features we are interested in. We can search for these.